Sha256: 87e4eabc63b98a9ca26de38ad830a866c3a09805aa3a15743b23e13ac07faab2
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# # HornetQ Producer: # Write messages to the queue # # Allow examples to be run in-place without requiring a gem install $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../../lib' require 'rubygems' require 'yaml' require 'hornetq' 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| 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 ###" # Send message to the queue producer.send(message) #puts message puts "#{i}\n" if i%1000 == 0 puts "Durable" if message.durable end duration = Time.now - start_time puts "Delivered #{count} messages in #{duration} seconds at #{count/duration} messages per second" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jruby-hornetq-0.2.1.alpha | examples/client/advanced/producer.rb |