Sha256: f6e895f3bff05dad93302670998935dec4bf7ec2e5d9fb4a42ced886fd4d6ed6

Contents?: true

Size: 492 Bytes

Versions: 124

Compression:

Stored size: 492 Bytes

Contents

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

require "rubygems"
require "bunny"

puts "=> Demonstrating queue TTL (queue leases)"
puts

conn = Bunny.new
conn.start

ch   = conn.create_channel
q    = ch.queue("", :exclusive => true, :arguments => {"x-expires" => 300})

sleep 0.4
begin
  # this will raise because the queue is already deleted
  q.message_count
rescue Bunny::NotFound => nfe
  puts "Got a 404 response: the queue has already been removed"
end

sleep 0.7
puts "Closing..."
conn.close

Version data entries

124 entries across 124 versions & 1 rubygems

Version Path
bunny-1.1.0.pre1 examples/guides/extensions/queue_lease.rb
bunny-1.0.4 examples/guides/extensions/queue_lease.rb
bunny-1.0.3 examples/guides/extensions/queue_lease.rb
bunny-1.0.2 examples/guides/extensions/queue_lease.rb
bunny-1.0.1 examples/guides/extensions/queue_lease.rb
bunny-1.0.0 examples/guides/extensions/queue_lease.rb
bunny-1.0.0.rc3 examples/guides/extensions/queue_lease.rb
bunny-1.0.0.rc2 examples/guides/extensions/queue_lease.rb
bunny-0.10.8 examples/guides/extensions/queue_lease.rb
bunny-1.0.0.rc1 examples/guides/extensions/queue_lease.rb
bunny-0.10.7 examples/guides/extensions/queue_lease.rb
bunny-0.10.6 examples/guides/extensions/queue_lease.rb
bunny-1.0.0.pre6 examples/guides/extensions/queue_lease.rb
bunny-0.10.5 examples/guides/extensions/queue_lease.rb
bunny-1.0.0.pre5 examples/guides/extensions/queue_lease.rb
bunny-0.10.4 examples/guides/extensions/queue_lease.rb
bunny-0.10.3 examples/guides/extensions/queue_lease.rb
bunny-1.0.0.pre4 examples/guides/extensions/queue_lease.rb
bunny-0.10.2 examples/guides/extensions/queue_lease.rb
bunny-0.10.1 examples/guides/extensions/queue_lease.rb