Sha256: 6c20af4e6db273b7fbd22299da9a5f23c7bc1eb8106c3a6a407965a35589c454
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
$:.unshift File.dirname(__FILE__) + '/../lib' require 'mq' EM.run{ def log *args p [ Time.now, *args ] end # AMQP.logging = true amq = MQ.new EM.add_periodic_timer(1){ puts log :sending, 'ping' amq.queue('one').publish('ping') } amq = MQ.new amq.queue('one').subscribe{ |msg| log 'one', :received, msg, :sending, 'pong' amq.queue('two').publish('pong') } amq = MQ.new amq.queue('two').subscribe{ |msg| log 'two', :received, msg } } __END__ [Sun Jul 20 03:52:24 -0700 2008, :sending, "ping"] [Sun Jul 20 03:52:24 -0700 2008, "one", :received, "ping", :sending, "pong"] [Sun Jul 20 03:52:24 -0700 2008, "two", :received, "pong"] [Sun Jul 20 03:52:25 -0700 2008, :sending, "ping"] [Sun Jul 20 03:52:25 -0700 2008, "one", :received, "ping", :sending, "pong"] [Sun Jul 20 03:52:25 -0700 2008, "two", :received, "pong"] [Sun Jul 20 03:52:26 -0700 2008, :sending, "ping"] [Sun Jul 20 03:52:26 -0700 2008, "one", :received, "ping", :sending, "pong"] [Sun Jul 20 03:52:26 -0700 2008, "two", :received, "pong"]
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
tmm1-amqp-0.5.1 | examples/pingpong.rb |
tmm1-amqp-0.5.2 | examples/pingpong.rb |
amqp-0.5.1 | examples/pingpong.rb |
amqp-0.5.2 | examples/pingpong.rb |