'How to test the IBM WebSphere Message Broker in JMeter

I have a scenario where i need to test the IBM WebSphere Message Broker(JMS request) in JMeter.

Currently i have below details with me. Using this below information, may i know how to create this script in JMeter.

Example : Queue manager name : ACE config SVR/TCP/localhost(1414), Queue name : DNB LT.SRVC, XML Payload

Also, Manual testing team is using the RHF utility to perform this testing.



Solution 1:[1]

I believe the best option is going for JSR223 Sampler and custom Groovy code.

  1. Download the relevant version of com.ibm.mq.allclient and drop it to "lib" folder of your JMeter installation (or other location which is in JMeter Classpath)

  2. Restart JMeter to pick the .jar up

  3. Add JSR223 Sampler to your Test plan

  4. Put the following code into "Script" area

    import com.ibm.msg.client.jms.JmsConnectionFactory
    import com.ibm.msg.client.jms.JmsFactoryFactory
    import com.ibm.msg.client.wmq.WMQConstants
    
    import javax.jms.Session
    
    def hostName = "127.0.0.1"
    def hostPort = 1414
    def channelName = "DEV.APP.SVRCONN"
    def queueManagerName = "QM1"
    def queueName = "DNB LT.SRVC"
    
    def ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER)
    def cf = ff.createConnectionFactory()
    
    cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, hostName)
    cf.setIntProperty(WMQConstants.WMQ_PORT, hostPort)
    cf.setStringProperty(WMQConstants.WMQ_CHANNEL, channelName)
    cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT)
    cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, queueManagerName)
    
    def conn = cf.createConnection("app", "test")
    def sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE)
    
    def destination = sess.createQueue(queueName)
    
    conn.start()
    
    def producer = sess.createProducer(destination)
    
    def payload = 'Your XML payload here'
    def msg = sess.createTextMessage(payload)
    
    producer.send(msg)
    
    producer.close()
    
    conn.close()
    sess.close()
    
  5. Run your test and the message should be sent

More information: IBM MQ testing with JMeter - Learn How

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T