jMeter - JMS Topic Test Plan

Advertisements


Building a JMS Topic Test Plan

Now let's write a JMeter test plan to test a JMS Providers. We will create one subscribers and one publisher. You will create 1 thread group and set each one to 2 iterations.

First let's start the JMeter from /home/manisha/apache-jmeter-2.9/bin/jmeter.sh.

Add Users

Now create a Thread group, right click on Test Plan > Add> Threads(Users)> Thread Group. Thread Group will get added under the Test Plan node. Rename this Thread Group as JMS pub-sub user.

Thread Group Added

We will change the Loop Count to 2. Rest of the default properties of the Thread Group are retained. This means that 1 threadgroup with 1 thread or user sends 2 messages each through a request queue.

Adding JMS Subscriber and Publisher

Add Publisher

Next add the sampler JMS Publisher to the Publisher element (Add > Sampler > JMS Publisher). Then, select the JMS Publisher element in the tree and edit the following properties:

PropertyValueDescription
NameSample Publisher Descriptive name for this element that is shown in the tree.
If the JMS provider uses the jndi.properties filecheck the boxuse jndi.properties. Note that the file must be on the classpath - e.g. by updating the user.classpath JMeter property. If this option is not selected, JMeter uses the "JNDI Initial Context Factory" and "Provider URL" fields to create the connection.
InitialContextFactoryorg.apache.activemq.jndi.ActiveMQInitialContextFactoryName of the context factory.
Provider URLtcp://localhost:61616The URL for the jms provider.
Connection FactoryConnectionFactoryThe URL for the jms provider.
DestinationdynamicTopics/MyStaticTopic1 the name of the message topic. For ActiveMQ Dynamic Topics (create topics dynamically).
Number of samples to aggregate2Number of samples to aggregate.
Message sourceTextareaWhere to obtain the message:
From File : means the referenced file will be read and reused by all samples
Random File from folder specified below : means a random file will be selected from folder specified below, this folder must contain either files with extension .dat for Bytes Messages, or files with extension .txt or .obj for Object or Text messages
Text area : The Message to use either for Text or Object message
Message typeTextText, Map, Object message or Bytes Message

Rest of properties are retained with the default values. The screen shot below shows above configurations:

JMS publisher sampler Add Subscriber

Now that we have defined our users, it is time to define the tasks that they will be performing. Start by adding the sampler JMS Subscriber to the Subscribers element (Add > Sampler > JMS Subscriber). Then, select the JMS Subscriber element in the tree and edit the following properties:

PropertyValueDescription
NameSample Subscriber Descriptive name for this element that is shown in the tree.
If the JMS provider uses the jndi.properties filecheck the boxuse jndi.properties. Note that the file must be on the classpath - e.g. by updating the user.classpath JMeter property. If this option is not selected, JMeter uses the "JNDI Initial Context Factory" and "Provider URL" fields to create the connection.
InitialContextFactoryorg.apache.activemq.jndi.ActiveMQInitialContextFactoryName of the context factory.
Provider URLtcp://localhost:61616The URL for the jms provider.
Connection FactoryConnectionFactoryThe URL for the jms provider.
DestinationdynamicTopics/MyStaticTopic1 the name of the message topic. For ActiveMQ Dynamic Topics (create topics dynamically).
Read responseCheck Boxshould the sampler read the response. If not, only the response length is returned.
Timeout2000Specify the timeout to be applied, in milliseconds. 0=none. This is the overall aggregate timeout, not per sample.

Rest of properties are retained with the default values. The screen shot below shows above configurations:

JMS subscriber sampler

Create Listener

Now add the Listener element. This element is responsible for storing all of the results of your JMS requests in a file and presenting a visual model of the data.

Select the Thread Group element and add a View Results Tree listener (Add > Listener > View Results Tree).

JMS Pub Sub Test Listener

Save and Execute Test Plan

Now save the above test plan as jms_pub_sub.jmx. Execute this test plan using Run > Start option.

Verify Output

Output for Publisher JMS Publish Sub Test Output JMS Publish Sub Test Output Output for Subscriber JMS Publish Sub Test Output JMS Publish Sub Test Output JMS Publish Sub Test Output

Return to the admin console of ActiveMQ, from this we can see message status in the topics.

JMS Publish Sub Admin Console

Advertisements
Advertisements