Skip to content

Instantly share code, notes, and snippets.

@murphybytes
Created March 15, 2012 01:27
Show Gist options
  • Save murphybytes/2041022 to your computer and use it in GitHub Desktop.
Save murphybytes/2041022 to your computer and use it in GitHub Desktop.
Heroku hosted iron mq message listener
require 'iron_mq'
$stdout.sync = true
def write_msg msg
puts "*"*10
puts msg
puts "*"*10
end
write_msg "I am listening"
ironmq = IronMQ::Client.new( 'token' => API_TOKEN, 'project_id' => PROJECT_ID )
while true
msg = ironmq.messages.get()
break if msg.body == 'quit'
write_msg msg.body if msg
sleep 1
end
write_msg "Goodbye"
exit(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment