Sha256: 30ac8779418abce85ecc7bfb860d80c7fd948c034fc30e031a06421c3ea341a3
Contents?: true
Size: 680 Bytes
Versions: 5
Compression:
Stored size: 680 Bytes
Contents
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "amqp" AMQP.start("amqp://guest:guest@dev.rabbitmq.com:5672/") do |connection, open_ok| AMQP::Channel.new do |channel, open_ok| exchange = channel.fanout("amq.fanout") channel.queue("", :auto_delete => true, :exclusive => true) do |queue, declare_ok| queue.bind(exchange).subscribe do |headers, payload| puts "Received a new message" end EventMachine.add_timer(0.3) do queue.unsubscribe puts "Unsubscribed. Shutting down..." connection.close { EM.stop { exit } } end # EventMachine.add_timer end # channel.queue end end
Version data entries
5 entries across 5 versions & 1 rubygems