examples/advanced/producer.rb in jruby-hornetq-0.3.1 vs examples/advanced/producer.rb in jruby-hornetq-0.3.2
- old
+ new
@@ -16,17 +16,18 @@
config = YAML.load_file(File.dirname(__FILE__) + '/hornetq.yml')['development']
# Create a HornetQ session
HornetQ::Client::Connection.session(config) do |session|
# Create a non-durable TestQueue to receive messages sent to the TestAddress
- session.create_queue_ignore_exists('TestAddress', 'TestQueue', false)
+ session.create_queue_ignore_exists('jms.queue.SampleQueue', 'jms.queue.SampleQueue', false)
start_time = Time.now
- session.producer('TestAddress') do |producer|
+ session.producer('jms.queue.SampleQueue') do |producer|
puts "Sending messages"
(1..count).each do |i|
message = session.create_message(HornetQ::Client::Message::TEXT_TYPE,false)
- message.body = "#{Time.now}: ### Hello, World ###"
+ message.body = "#{Time.now}: #{i} : ### Hello, World ###"
+ message.user_id = Java::org.hornetq.utils::UUIDGenerator.getInstance.generateUUID
producer.send(message)
puts "#{i}\n" if i%1000 == 0
end
end