Skip to content

Instantly share code, notes, and snippets.

@chelm
Created January 13, 2011 19:27
Show Gist options
  • Save chelm/778436 to your computer and use it in GitHub Desktop.
Save chelm/778436 to your computer and use it in GitHub Desktop.
begin
Qusion.start(ENV)
RAILS_DEFAULT_LOGGER.debug "Started Qusion \n\n"
rescue => e
raise "Failed to start Qusion: #{e} \n\n"
end
#subscribe
EM.next_tick do
## create a dataset queue pass all messages to the dataset updater
#ds_queue = MQ.queue('dataset_queue')
#ds_queue.subscribe do |msg|
# updater.route(Marshal.load(msg))
#end
# note that #bind is never called; it is implicit because
# the exchange and queue names match
queue = MQ.queue('log queue')
queue.subscribe do |header, body|
RAILS_DEFAULT_LOGGER.debug header
RAILS_DEFAULT_LOGGER.debug "received payload1 [#{body}]"
end
queue2 = MQ.queue('analysis')
queue2.subscribe(:ack => true) do |header, body|
RAILS_DEFAULT_LOGGER.debug header
RAILS_DEFAULT_LOGGER.debug "received payload2 [#{body}]"
msg = Marshal.load body
RAILS_DEFAULT_LOGGER.debug msg.inspect
headers.ack
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment