Skip to content

Instantly share code, notes, and snippets.

@solars
Created August 17, 2011 08:23
Show Gist options
  • Save solars/24424819c4ef8e4a03d5 to your computer and use it in GitHub Desktop.
Save solars/24424819c4ef8e4a03d5 to your computer and use it in GitHub Desktop.
# omitted
client = Stomp::Client.new(config.queue.user,
config.queue.pass,
config.queue.host,
config.queue.port,
true
)
client.subscribe(config.queue.name, :ack => 'client') do |msg|
begin
data = JSON.parse(msg.body)
DaemonKit.logger.info "Processing #{data['update_type']} for #{data['hotel_code']} from #{data['timestamp']}}"
save_update(data)
DaemonKit.logger.info "Update processed"
client.acknowledge(msg)
DaemonKit.logger.info "Acknowledged"
rescue Exception => e
# omitted
end
end
client.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment