суббота, 4 мая 2013 г.

simple client for hornetQ for testing


I like rabbitmq, but for java projects nice choice is hornetq embedded in jboss.
The best way for testing is write code on ruby.
I use library jruby-hornetq


# tested by jruby
require 'rubygems'
require 'hornetq'

connection = HornetQ::Client::Connection.new(:uri => 'hornetq://localhost/')
session = connection.create_session(:username=>'guest',:password=>'secret')


producer = session.create_producer('jms.queue.QeueuName123')
message = session.create_message(HornetQ::Client::Message::TEXT_TYPE,false)
message.body_buffer.write_string('Hello World')
producer.send(message)
session.close
connection.close


java-freek-way is not for me :)
Отправить комментарий