#!/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