Sha256: 057e96a58e326100e1f28bdd844bdede60817441bc178fdde825706eae89abce
Contents?: true
Size: 955 Bytes
Versions: 2
Compression:
Stored size: 955 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, :browse_only=>true) do |message| p message puts "==================================" message.acknowledge end puts "Browsed #{stats[:count]} messages in #{stats[:duration]} seconds at #{stats[:messages_per_second]} messages per second" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jruby-hornetq-0.5.0.alpha | examples/producer-consumer/browse_all.rb |
jruby-hornetq-0.4.0 | examples/producer-consumer/browse_all.rb |