Using Jmeter to Performance Test Secured JMS

M3 API framework has recently developed a set of Java Message Service(JMS) services as part of the requirement for M3IS+ application at Brandix i3

Currently M3 API framework stands as an interface with various types of integration choices to M3.

Load/Performance testing the developed JMS services was part of the planned testing process and this post describes how to use Jmeter to performance test JMS.

JMS supports two models/domains for messaging:

  • Queues : Point-to-Point model – Each message has only one consumer.
  • Topics : Publish/Subscribe model – Each message can have multiple consumers.

The solution provided by M3 API framework uses the Point-to-Point model and the transport layer is secured with SSL for secure communication.

The JMeter test described below uses 1 threadgroup with 5 threads or users sending 2 messages each through JMS request queue.

  1. Start JMeter using jmeter.bat
  1. 2.Right click on Test Plan > Add> Threads(Users)> Thread Group. Rename this Thread Group.

Eg:- Thread Group-ComponentUpdate

  1. Set Number of Threads (users): 5

Ramp-Up Period (in seconds): 1
Loop Count: 2


This means 5 users/threads will be started in 1 second and send 2 messages each to our JMS request queue.

  1. Now we have to add an element to our test plan that can send messages to our JMS request queue. Jmeter provides JMS Point-to-Point sampler to achieve this.

To add this to our test plan, Right click on Thread Group, Add > Sampler > JMS Point-to-Point

Rename this with a name of the service that we are going to test. Eg:- JMS-ComponentUpdate


  1. Configure the sampler by giving values for the properties as below:
Property Value Description
QueueuConnectionFactory ConnectionFactory This is the default JNDI entry for the connection factory within active mq.
JNDI Name Request Queue request-queue This is the JNDI name of the queue to which the messages are sent.

(Value for this is defined in the JNDI Properties section below)

JNDI Name Receive Queue response-queue This is the JNDI name of the queue to which the messages are received.

(Value for this is defined in the JNDI Properties section below)

Communication Style Request Response
Use Request message ID checked JMeter use the Request message ID for correlation between the sent and received message
Use Response message ID unchecked
Time(milliseconds) 2000 If a reply has not been received within the specified time, the specific testcase failes.
Content Testing point to point Content of the request message.

See below for a sample message

JMS Properties
operation componentUpdate This is the Operation name of the service that we are going to test
InitialContextFactory org.apache.activemq.jndi.


The standard InitialContextFactory for Active MQ
JNDI Properties
queue.request-queue customerorder-request-queue Request queue name is set here
queue.response-queue customerorder-response-queue Response queue name is set here
userName  Username to authenticate as SSL is used
password  Password to authenticate as SSL is used
Provider URL ssl:// The URL for the jms provider. SSL is used here.

A Sample message would look like below:

<bom:componentCreationRequest xmlns:cus="http://www.xxxxx" xmlns:bom="http://www.xxxxx" xmlns:com="http://www.xxxxx">

<!--1 or more repetitions:-->























<!--Zero or more repetitions:-->











  1. As we can see in  the above request message, some fields were parameterized to read data from a csv file.

Eg:- <bom:productNumber>${ITEMNUM}</bom:productNumber>

To do this, we need a CSV Data Set Config element added to the Test Plan.

Right click on Thread Group, Add > Config Element > CSV Data Set Config

Configure as per the below screenshot:


  1. Since we want to simulate multiple users consuming the service, we need to specify the user credentials for each users to access.

To do this we can add a User Parameters element to the test plan.

Right click on Thread Group, Add > Pre Processors > User Parameters


As per the below screenshot, username & password for each user can be provided.


  1. Then add few listeners to the Test Plan to view the results of the test execution. Eg:- View Results Tree, Summary Report etc…

To do this, Right click on Thread Group, Add > Listner > View Result Tree

Now Start the test by clicking on the Start button.


NOTE: If you get a “SSLHandshakeException: PKIX: unable to find valid certification path to requested target” error message, add the

HTTPS SSL certificate to the local java cacerts file as given in the following link: