Skip to content

Instantly share code, notes, and snippets.

@unakatsuo
Created April 15, 2010 09:50
Show Gist options
  • Save unakatsuo/366921 to your computer and use it in GitHub Desktop.
Save unakatsuo/366921 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'mq'
EM.run {
amq = MQ.new
amq.topic('evp-started')
amq.topic('evp-stopped')
amq.queue('evc-capall').bind('evp-started', :key=>'*')
amq.queue('evc-capall').bind('evp-stopped', :key=>'*')
amq.queue('evc-capall').subscribe{ |msg|
puts msg
}
EM.add_periodic_timer(3) {
amq.topic('evp-started').publish('from started', :key=>'nnn')
}
EM.add_periodic_timer(4) {
amq.topic('evp-stopped').publish('from stopped', :key=>'ttt')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment