Sha256: a86c4f66913bc5b5af61bd935aeae65910cc4cc6e00abcc73c591cef3c2a214b
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
# # HornetQ Producer: # 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 'hornetq' # Using Connect.session since a session does not have to be started in order # to produce messages HornetQ::Client::Connection.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) # Using the Producer pattern send messages to the Address 'TestAddress' session.producer('TestAddress') do |producer| # Create a non-durable message message = session.create_message(false) # Mark message as text message.type_sym = :text # Always set the message type prior to setting the body so that the message # is correctly created for you message.body = "#{Time.now}: ### Hello, World ###" producer.send(message) puts "Sent Message: #{message.inspect}" end end
Version data entries
5 entries across 5 versions & 1 rubygems