Sha256: 35f4bbdc78140e7377335a7ec2d96183abd6c6010beec6301b773206be44b121
Contents?: true
Size: 633 Bytes
Versions: 124
Compression:
Stored size: 633 Bytes
Contents
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "bunny" puts "=> Demonstrating per-queue message TTL" puts conn = Bunny.new conn.start ch = conn.create_channel x = ch.fanout("amq.fanout") q = ch.queue("", :exclusive => true, :arguments => {"x-message-ttl" => 1000}).bind(x) 10.times do |i| x.publish("Message #{i}") end sleep 0.7 _, _, content1 = q.pop puts "Fetched #{content1.inspect} after 0.7 second" sleep 0.8 _, _, content2 = q.pop msg = if content2 content2.inspect else "nothing" end puts "Fetched #{msg} after 1.5 second" sleep 0.7 puts "Closing..." conn.close
Version data entries
124 entries across 124 versions & 1 rubygems