Sha256: c3b573bd250b79581c8b76e0cda10662e3e99f57c0fd0fd983e9217c45cdce71

Contents?: true

Size: 564 Bytes

Versions: 66

Compression:

Stored size: 564 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

require "rubygems"
require "bunny"

puts "=> Demonstrating basic.nack"
puts

conn = Bunny.new
conn.start

ch   = conn.create_channel
q    = ch.queue("", :exclusive => true)

20.times do
  q.publish("")
end

20.times do
  delivery_info, _, _ = q.pop(:ack => true)

  if delivery_info.delivery_tag == 20
    # requeue them all at once with basic.nack
    ch.nack(delivery_info.delivery_tag, true, true)
  end
end

puts "Queue #{q.name} still has #{q.message_count} messages in it"

sleep 0.7
puts "Disconnecting..."
conn.close

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
bunny-1.4.1 examples/guides/extensions/basic_nack.rb
bunny-1.4.0 examples/guides/extensions/basic_nack.rb
bunny-1.3.1 examples/guides/extensions/basic_nack.rb
bunny-1.3.0 examples/guides/extensions/basic_nack.rb
bunny-1.2.2 examples/guides/extensions/basic_nack.rb
bunny-1.2.1 examples/guides/extensions/basic_nack.rb
bunny-1.2.0 examples/guides/extensions/basic_nack.rb
bunny-1.1.9 examples/guides/extensions/basic_nack.rb
bunny-1.1.8 examples/guides/extensions/basic_nack.rb
bunny-1.1.7 examples/guides/extensions/basic_nack.rb
bunny-1.1.6 examples/guides/extensions/basic_nack.rb
bunny-1.1.5 examples/guides/extensions/basic_nack.rb
bunny-1.1.4 examples/guides/extensions/basic_nack.rb
bunny-1.1.3 examples/guides/extensions/basic_nack.rb
bunny-1.1.2 examples/guides/extensions/basic_nack.rb
bunny-1.1.1 examples/guides/extensions/basic_nack.rb
bunny-1.1.0 examples/guides/extensions/basic_nack.rb
bunny-1.1.0.rc1 examples/guides/extensions/basic_nack.rb
bunny-1.0.7 examples/guides/extensions/basic_nack.rb
bunny-1.0.6 examples/guides/extensions/basic_nack.rb