Thursday, May 8, 2014

JMeter and JMS (HornetQ)

Here is how I send/receive messages to hornetQ  JMS:

- Create a Thread Group,
- To Send messages, use JMS publisher sampler and to receive create a JMS subscriber sampler.
- Copy library files into jmeter/lib/ext:
  • hornetq-commons.jar
  • hornetq-core-client.jar
  • hornetq-jms-client.jar
  • jnp-client.jar
  • netty.jar
Set following parameters as:
  • initial Context Factory: org.jnp.interfaces.NamingContextFactory
  • Provider URL: (your provider url, seriously!, usually starts with jnp:// and ends with the port 1099)
  • Connection Factory: ConnectionFactory
  • Destination: The topic or queue you want to connect.
For publisher sampler you can add more properties in the JMS Properties box. I like to add something to JMSCorrelationID header, so I add that property as well.

For subscriber sampler, you can parametrize the JMS Selector parameter. As an instance, if you want to search for a queue with a specific correlation id, put something like: JMSCorrelationID = '${yourVariable}'

The most possible problem you migh encounter is the blocked ports. Please make sure ports 1099 and 1098 are both open in both local and network firewalls.

That's it.