Sha256: 1cb274d226225839bd5485ead3048d8d0f1d216c5930b67abe59ed3f818d1917
Contents?: true
Size: 940 Bytes
Versions: 1
Compression:
Stored size: 940 Bytes
Contents
# # HornetQ Consumer: # Read a single message from the queue # # Allow examples to be run in-place without requiring a gem install $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib' require 'rubygems' require 'hornetq' # Using Connect.start since a session must be started in order to consume messages HornetQ::Client::Connection.start_session('hornetq://localhost') do |session| # Create a non-durable TestQueue to receive messages sent to the TestAddress session.create_queue_ignore_exists('TestAddress', 'TestQueue', false) # Consume All messages from the queue and gather statistics stats = session.consume(:queue_name => 'TestQueue', :timeout=> 0, :statistics=>true) do |message| p message puts "==================================" message.acknowledge end puts "Consumed #{stats[:count]} messages in #{stats[:duration]} seconds at #{stats[:messages_per_second]} messages per second" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jruby-hornetq-0.4.0 | examples/producer-consumer/consume_all.rb |