Skip to content

Instantly share code, notes, and snippets.

@ropiku
Created November 19, 2009 16:25
Show Gist options
  • Save ropiku/238858 to your computer and use it in GitHub Desktop.
Save ropiku/238858 to your computer and use it in GitHub Desktop.
require 'eventmachine'
require 'mq'
module Echo
def initialize(mq)
@mq = mq
end
def receive_data(data)
@mq.queue('log').publish(data)
end
end
AMQP.start(:host => 'localhost') do
mq = MQ.new
f = File.open(ARGV[0], "r")
EventMachine::attach(f, Echo, mq)
end
require 'mq'
AMQP.start(:host => 'localhost') do
amq = MQ.new
amq.queue('log').subscribe{ |msg|
print msg
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment