examples/client/advanced/client.rb in jruby-hornetq-0.2.1.alpha vs examples/client/advanced/client.rb in jruby-hornetq-0.2.3.alpha
- old
+ new
@@ -14,20 +14,20 @@
timeout = (ARGV[1] || 30000).to_i
config = YAML.load_file(File.dirname(__FILE__) + '/hornetq.yml')['development']
# Create a HornetQ session
-HornetQ::Client::Factory.create_session(config) do |session|
+HornetQ::Client::Factory.session(config) do |session|
#session.create_queue('Example', 'Example', true)
requestor = session.create_requestor('jms.queue.ExampleQueue')
session.start
start_time = Time.now
puts "Sending messages"
(1..count).each do |i|
message = session.create_message(HornetQ::Client::Message::TEXT_TYPE,false)
# Set the message body text
- message << "Request Current Time"
+ message.body = "Request Current Time"
# Set the user managed message id
message.user_id = Java::org.hornetq.utils::UUIDGenerator.getInstance.generateUUID
# Send request message and wait for reply
if reply = requestor.request(message, timeout)
puts "Received Response: #{reply.inspect}" if count < 10