Wednesday, June 12, 2013

How to use Jmeter JMS publisher & subscriber with ActiveMQ

This post describes basic steps to how to use Jmeter JMS publisher and subscriber with ActiveMQ.

Copy the activemq-core-5.4.3.jar to the JMETER_HOME/lib/ directory and start the Jmeter.

JMS publisher
Fill following fields.
  • Initial Connection Factory: org.apache.activemq.jndi.ActiveMQInitialContextFactory
  • Provider URL: tcp://localhost:61616 
  • Connection factory: ConnectionFactory 
  • Destination: dynamicQueues/test 
  • JMS Properties:  SOAPAction - urn:placeOrder and Content-Type - text/xml; charset=UTF-8 ( I have added two properties in my sample) 
  • Message: <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:ReplyTo><wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address></wsa:ReplyTo><wsa:MessageID>urn:uuid:3460afc7-dda1-4eed-ba2e-acacda943384</wsa:MessageID><wsa:Action>urn:placeOrder</wsa:Action></soapenv:Header><soapenv:Body><m0:placeOrder xmlns:m0="http://services.samples"><m0:order><m0:price>96.78974610308872</m0:price><m0:quantity>19374</m0:quantity><m0:symbol>IBM</m0:symbol></m0:order></m0:placeOrder></soapenv:Body></soapenv:Envelope>



JMS Subscriber
Fill following fields.
  • Initial Connection Factory: org.apache.activemq.jndi.ActiveMQInitialContextFactory
  • Provider URL: tcp://localhost:61616 
  • Connection factory: ConnectionFactory 
  • Destination: dynamicQueues/test 


When you execute the jmeter script you can see the published message is getting from the subscriber.

2 comments:

  1. Hello Aparna Karunarathna, Thank you for sharing the JMS publish - subscribe scripts. In the above case, you have given the same Destination for both Publish and Subscribe. I think the 2 destinations should be different otherwise it is obvious that the same request is received in response. Could you please explain it?

    Thank you,

    ReplyDelete
  2. Hi Aparna,

    How to increase the performance of the JMS subscriber . I am currently running the subscriber with 26 threads and expecting to run at 26 tps based on the threadgroup setup . However I am seeing about 5 TPS . Could you please suggest how we can improve the throughput for JMS Subcriber

    ReplyDelete