Sha256: 22e3d2b74bfd9b7d16526b73bc75d1de43709397068c94391d4d057dea82c508

Contents?: true

Size: 571 Bytes

Versions: 58

Compression:

Stored size: 571 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(:manual_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

58 entries across 58 versions & 1 rubygems

Version Path
bunny-1.7.1 examples/guides/extensions/basic_nack.rb
bunny-2.1.0 examples/guides/extensions/basic_nack.rb
bunny-2.0.1 examples/guides/extensions/basic_nack.rb
bunny-2.0.0 examples/guides/extensions/basic_nack.rb
bunny-2.0.0.rc2 examples/guides/extensions/basic_nack.rb
bunny-2.0.0.rc1 examples/guides/extensions/basic_nack.rb
bunny-1.7.0 examples/guides/extensions/basic_nack.rb
bunny-1.6.3 examples/guides/extensions/basic_nack.rb
bunny-1.6.2 examples/guides/extensions/basic_nack.rb
bunny-1.6.1 examples/guides/extensions/basic_nack.rb
bunny-1.6.0 examples/guides/extensions/basic_nack.rb
bunny-1.5.1 examples/guides/extensions/basic_nack.rb
bunny-1.6.0.rc2 examples/guides/extensions/basic_nack.rb
bunny-1.6.0.rc1 examples/guides/extensions/basic_nack.rb
bunny-1.6.0.pre1 examples/guides/extensions/basic_nack.rb
bunny-1.5.0 examples/guides/extensions/basic_nack.rb
bunny-1.5.0.pre2 examples/guides/extensions/basic_nack.rb
bunny-1.5.0.pre1 examples/guides/extensions/basic_nack.rb