Skip to content

Instantly share code, notes, and snippets.

@Fivell
Created September 15, 2012 10:59
Show Gist options
  • Save Fivell/3727344 to your computer and use it in GitHub Desktop.
Save Fivell/3727344 to your computer and use it in GitHub Desktop.
ruby stomp subscriber example with durable topics
require 'rubygems'
require 'stomp'
client_id = "client-id"
subscription_name = "subName"
topic_name = "topicName"
stomp_params = {
:hosts => [
{ :host => "localhost", :port => 61613},
],
:connect_headers => {'client-id' => client_id},
}
client = Stomp::Client.new stomp_params
client.subscribe "/topic/#{topic_name}", { "ack" => "client", "activemq.subscriptionName" => subscription_name} do |msg|
puts "--------------body----------------"
p msg.body
puts "--------------headers----------------"
p msg.headers
puts "-----end-----"
client.acknowledge msg
end
client.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment