activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drystone <>
Subject Re: Using ActiveMQ embedded sever for Testing
Date Tue, 06 Jun 2006 15:25:26 GMT

Maybe I am going about this in the wrong manner but the code that I am trying
to test is vendor neutral  JMS code.  I am trying to test code that will
send and receive messages for different implementations of the JMS spec:

Example of code that I am trying to test:

Properties properties = could equal JBoss/MQSeries/ActiveMQ properties
InitialContext initialContext = new InitialContext( properties );
Queue queue = (Queue) initialContext.lookup( queueName );
QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory)
           initialContext.lookup( JBoss/MQSeries/ActiveMQ ConnectionFactory
QueueConnection queueConnection =
QueueSession queueSession = queueConnection.createQueueSession( false,
           Session.AUTO_ACKNOWLEDGE );
QueueSender queueSender = queueSession.createSender( queue )
Message jmsMessage = queueSession.createTextMessage( message.toString() );
queueSender.send( message );
similar for receiving JMS messages

I do not want to add any ActiveMQ specific code for the above. I was hoping
that I would be able to build a configuration object, one for each of the
JMS implementations JBoss/MQSeries/ActiveMQ. These objects would be used
within the generic JMS code to set the correct values in the JMS objects and
they would use the configured resources present.  The generic JMS code that
I have works for both JBoss and QSeries, I would just like a way of testing
it. I thought that if there was this BrokerService present that would get
picked up and would be used.

If I used ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");  this
would be a different way that I would be accessing a JMS resource instead of
the generic code above, and by passing the code that my application uses
therefore not fully testing it.

I am sorry if I am being stupid but I am new to ActiveMQ and do not fully
understand how it should work. Should I be swapping out my generic JMS code
for ActiveMQ code when I am testing application sections that use JMS?

Thanks for your help.
View this message in context:
Sent from the ActiveMQ - User forum at

View raw message