Shahzad Bhatti Welcome to my ramblings and rants!

August 3, 2006

#!/usr/bin/env ruby -w

Filed under: Computing — admin @ 8:26 am

#!/usr/bin/env ruby -w

require ‘rubygems’
require ‘stomp’

#class Publisher < ActiveMessaging::Processor # publishes_to :ServerSideQ # #end #pub = Publisher.new #pub.publish :message => “Go Sox!”

client = Stomp::Client.open nil, nil, “localhost”, 61613
client.subscribe(“/queue/clientSideReplyQ”, {
“persistent” => true,
“client-id” => “rubyClient”,
}) do |message|
puts “Got Reply: #{message.body} on #{message.headers[‘destination’]}”
client.ack message
end

for i in 1..5 do
m = “Go Sox #{i}!”
puts m
client.send(“/queue/ServerSideQ”, m, {
“persistent” => true,
“priority” => 4,
“reply-to” => “/queue/clientSideReplyQ”,
}
)
end
puts “Waiting for response on /queue/clientSideReplyQ”
gets
client.close #disconnect

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.

Powered by WordPress