examples/client/advanced/producer.rb in jruby-hornetq-0.2.1.alpha vs examples/client/advanced/producer.rb in jruby-hornetq-0.2.3.alpha
- old
+ new
@@ -12,18 +12,18 @@
count = (ARGV[0] || 1).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|
producer = session.create_producer('jms.queue.ExampleQueue')
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 << "#{Time.now}: ### Hello, World ###"
+ message.body = "#{Time.now}: ### Hello, World ###"
# Send message to the queue
producer.send(message)
#puts message
puts "#{i}\n" if i%1000 == 0
puts "Durable" if message.durable