examples/producer-consumer/consumer.rb in jruby-hornetq-0.4.0 vs examples/producer-consumer/consumer.rb in jruby-hornetq-0.5.0.alpha
- old
+ new
@@ -9,13 +9,13 @@
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 the non-durable TestQueue to receive messages sent to the TestAddress
session.create_queue_ignore_exists('TestAddress', 'TestQueue', false)
-
+
session.consumer('TestQueue') do |consumer|
# Receive a single message, return immediately if no message available
if message = consumer.receive_immediate
puts "Received:[#{message.body}]"
message.acknowledge