Sha256: 15fe9de3bdc99ba5cc976b9c323f7fb09c715f46aa656c2d5311e30ea2f3aee7

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

#
# HornetQ Consumer:
#          Write a single message 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 'hornetq'

HornetQ::Client::Factory.start(:connector=> {:uri => 'hornetq://localhost'}) do |session|
  consumer = session.create_consumer('jms.queue.ExampleQueue')
  
  # Receive a single message, return immediately if no message available
  if message = consumer.receive_immediate
    puts "Received:[#{message.body}]"
    message.acknowledge
  else
    puts "No message found"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jruby-hornetq-0.2.5.alpha examples/client/consumer.rb
jruby-hornetq-0.2.3.alpha examples/client/consumer.rb
jruby-hornetq-0.2.1.alpha examples/client/consumer.rb