...
- Start a new JMeter instance by executing the following script from the
<JMeter_Home>/bin
folder:- On windows:
jmeter.bat
- On Linux:
sh jmeter.sh
- On windows:
- Go to the JMeter UI and create a JMS subscriber as explained below.
- Create a new thread group: Right-click Test Plan (in the left navigator) and go to Add -> Threads (Users) -> Thread Group.
- The new thread group will now be listed in the left navigator under the Test Plan.
- Right-click on the new thread group and go to Add -> Sampler -> JMS Subscriber.
- Name this subscriber
Games Subscriber
. You will now have a JMS Subscriber node in the left navigator. Select this node and enter the following details:
Initial Context Factory org.wso2.andes.jndi.PropertiesFileInitialContextFactory The connection details you specified in the
jnditopics.properties
file should be entered for the JMS Subscriber as shown below.Provider URL The location where you saved the jnditopics.properties
file.Connection Factory TopicConnectionFactory
.Destination The jndi JNDI name given to the topic hierarchy in the jnditopics.properties
file. For example, to subscribe to all the topics in the topic hierarchy, enter 'All_Games'.- Right-click on the new test plan Thread Group and go to Add -> Listener -> View Results in Tree. This will create a listener node in the JMeter navigator for analysing the output of the subscription.
Save the information. You now have a JMS client subscribed to the 'games' topic and all its child topics.
Execute the JMeter client.
Now, go to the management console of the Message Broker profile and go to Main -> Subscriptions -> Topic Subscription List. Your subscription will be listed as a non-durable topic subscription:
...
- Open two separate instances of JMeter by executing the following script from the
<JMeter_Home>/bin
folder:- On windows:
jmeter.bat
- On Linux:
sh jmeter.sh
- On windows:
Create JMS subscribers in both JMeter instances. Name them JMS Durable Subscriber 01 and JMS Durable Subscriber 2 respectively. Use the following connection details (same as for the non-durable subscription).
Initial Context Factory org.wso2.andes.jndi.PropertiesFileInitialContextFactory Provider URL This should be the location where you have the jnditopics.properties
file saved.Connection Factory This should be set to TopicConnectionFactory
.Destination This should be the jndi name given to the topic hierarchy in the jnditopics.properties
file. For example, to subscribe to all the topics in the topic hierarchy, enter 'All_Games'.In addition to the above configuations, be sure to add durable subscription IDs for both subscribers. Let's use Sub_1 and Sub_2 to identify the subscriptions.
For JMS Durable Subscriber 01:
Durable Subscription ID Sub_1 For JMS Durable Subscriber 02:
Durable Subscription ID Sub_2
- Right-click on the new test plan Thread Group and go to Add -> Listener -> View Results in Tree. This will create a listener node in the JMeter navigator for analysing the output of the subscription.
Save the information.
- Execute both the JMeter instances.
- Now, go to the management console of the Message Broker profile and go to Main -> Subscriptions -> Topic Subscription List. The durable subscriptions will be listed as active durable subscriptions:
- Now, open the JMeter instance for
JMS Durable Subscriber 02
and close stop the connectionexecution. - Now, the disconnected durable subscriber will be listed as an inactive durable subscription in the management console as shown below.
...
We will now set up Apache JMeter as a JMS publisher. Note that, in
Note |
---|
In the previous steps, we created three subscriptions for All Topics in the topic hierarchy. This means all three subscribers should receive the messages published to any one of the topics in the topic hierarchy. |
Follow the instructions given below.
Start a new JMeter instance by executing the following script from the
<JMeter_Home>/bin
folder:- On windows:
jmeter.bat
- On Linux:
sh jmeter.sh
- On windows:
Create a new test plan Thread Group in JMeter: Right-click on Test Plan (in the left navigator) and go to Add -> Threads (Users) -> Thread Group.
- The new thread group will now be listed in the left navigator as a test planunder the Test Plan.
- Right-click on the new test plan Thread Group and go to Add -> Sampler -> JMS Publisher.
- Name this publisher Games Publisher.
You will now have a JMS Publisher node in the left navigator. Select this node and enter the following details:
Initial Context Factory org.wso2.andes.jndi.PropertiesFileInitialContextFactory
The connection details you specified in the
jnditopics.properties
file should be entered for the JMS Publisher as shown below.Provider URL This should be the The location where you have saved the jnditopics.properties
file saved.Connection Factory This should be set to TopicConnectionFactory
.Destination This should be the jndi The JNDI name of the topic to which the message should be published. The jnditopics.properties
file specifies the mapping between topic names and jndi names. For example, as specified in thejnditopics.properties
file, enter 'Cricket_Only' if you want to publish a message to thecricket
topic. Alternatively, you can publish to any of the following destinations: 'Football_Only
', 'Germany_Only
', 'Brazil_Only
', 'India_Only
', 'Australia_Only
'.Expiration 0 Priority 0 Save the information. You now have a JMS client ready to send messages.
- Execute the JMeter publisher.
Go back to the management console of the MB profile and go to Subscriptions -> Topic Subscription List in the Main tab. You will observe the following:
Note the following:
- The non-durable topic subscription has immediately received the published messaged. You can verify this from the View Results in Tree tab of the respective JMeter client.
- The first durable subscription (Sub_1) has also received the published message. Verify this from the View Results in Tree tab of the respective JMeter client.
- The second durable subscription (Sub_2) has not received the message because the subscription was inactive. However, the unconsumed message is listed as a pending delivery for the subscriber as shown above. This means that as soon as Sub_2 becomes active, the message will be delivered.