Sha256: 276bc01786f6cf03a3d1c0d32ab29a725347f93ecf79d8905455874c74b14d93
Contents?: true
Size: 943 Bytes
Versions: 2
Compression:
Stored size: 943 Bytes
Contents
# # HornetQ Consumer: # 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' timeout = (ARGV[0] || 1000).to_i config = YAML.load_file(File.dirname(__FILE__) + '/hornetq.yml')['development'] # Create a HornetQ session HornetQ::Client::Factory.session(config) do |session| consumer = session.create_consumer('jms.queue.ExampleQueue') session.start count = 0 start_time = Time.now while message = consumer.receive(timeout) count = count + 1 message.acknowledge puts "==================================" text = message.body p text p message puts "Durable" if message.durable end duration = Time.now - start_time - timeout/1000 puts "Received #{count} messages in #{duration} seconds at #{count/duration} messages per second" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jruby-hornetq-0.2.5.alpha | examples/client/advanced/consumer.rb |
jruby-hornetq-0.2.3.alpha | examples/client/advanced/consumer.rb |