Wednesday, June 11, 2014

How to use Jmeter JMS publisher & subscriber with WSO2 Message Broker

This post describes basic steps to how to use Jmeter JMS publisher and subscriber with WSO2 Message Broker.

First copy all the client libraries from WSO2MB_HOME/client-lib/ to the JMETER_HOME/lib/ directory and start the Jmeter.

For WSO2 MB you cannot connect directly like activemq connection(see my previous post), you have to use a myjndi.propertise file. 'myjndi.propertise' file contains the connection details and Queue/Topic details.

myjndi.properties

#  Copyright (c) 2011, WSO2 Inc. (http://wso2.com) All Rights Reserved.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

# register some connection factories
# connectionfactory.[jndiname] = [ConnectionURL]
connectionfactory.Connectionfactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://192.168.10.5:5682'

# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.TestQ = TestQ

# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
topic.TestT = TestT

JMS Publisher (Queues/Topics)
  • Initial Connection Factory:  org.wso2.andes.jndi.PropertiesFileInitialContextFactory
  • Provider URL: /home/aparna/Blogging/myjndi.properties
  • Connection Factory: ConnectionFactory 
  • Destination: TestQ ( or TestT - you can add hierarchical topic as TestT.L1T)
  • JMS Properties:  SOAPAction - urn:placeOrder and Content-Type - text/xml 
  • 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>

Queue or Topic (sample request)

 JMS Subscriber (Queues/Topics)
  • Initial Connection Factory:  org.wso2.andes.jndi.PropertiesFileInitialContextFactory
  • Provider URL: /home/aparna/Blogging/myjndi.properties
  • Connection Factory: Connectionfactory
  • Destination: TestQ  

Queue or Topic (sample request)

Now you can execute publisher & subscriber jmeter scripts. Published messages are getting from Subscriber.