def run
client_hdrs = {"accept-version" => "1.1",
"host" => virt_host,
}
client_hash = { :hosts => [
{:login => login, :passcode => passcode, :host => host, :port => port},
],
:connect_headers => client_hdrs,
}
client = Stomp::Client.new(client_hash)
puts "Client Connect complete"
raise "Unexpected protocol level" if client.protocol() != Stomp::SPL_11
qname = "/queue/client.nodea.nodeb.nodec"
data = "message payload: #{Time.now.to_f}"
headers = {}
client.publish qname, data
puts "Publish complete"
uuid = client.uuid()
message = nil
client.subscribe(qname, {'id' => uuid}) {|m|
message = m
}
sleep 0.1 until message
puts "Subscribe and receive complete"
client.unsubscribe qname, {'id' => uuid}
raise "Unexpected data" if data != message.body
raise "Bad subscription header" if uuid != message.headers['subscription']
client.close
puts "Client close complete"
end