0

I have been trying to connect to IBM MQ from JMeter JMS publisher. Unable to find corrert "Initial context factory" and "connection factory" values to use without JNDI properties. I have all MQ jars present in LIB folder.

I have the following information-host name - Venus, Port - 21717, Destination Queue name - request.queue,Queue manager - venus.QMGR,channel - venus.server.chl (no authorization required).

My requirement - To connect to IBM MQ using JMS publisher with above details. But I am not able to sort out on what to give for Provider URL, Initial context factory and connection factory. Can you please help as this has been bugging me for past two weeks and couldn't find a solution yet? It would be great if you can tell me on where to populate the above values in JMS publisher as well for connecting to IBM MQ.

I have tried with user.classpath=/folder/with/mq/jars as well but it is not working and all jars are in place with JMeter restart still no luck.

Note: I have gone through all sites in these two weeks but couldn't get any luck.

JoshMc
  • 10,239
  • 2
  • 19
  • 38
Ajay N
  • 1
  • 2
  • Possible duplicate of [Jmeter to connect to IBM MQ](https://stackoverflow.com/questions/33278071/jmeter-to-connect-to-ibm-mq) – Ori Marko Jul 14 '17 at 02:28
  • Yeah, I have seen that but it is not helpful. I have done all those things but still unable to connect to MQ using JMS publisher/point-to-point. – Ajay N Jul 14 '17 at 07:51

2 Answers2

1

Example configuration steps would be something like:

  1. Add javax.jms-api.-x.x.x jar to JMeter Classpath
  2. Add mq-allclient-x.x.x.x.jar to JMeter Classpath
  3. Add JSR223 Sampler to your Test Plan
  4. Put the following code into "Script" area:

    import com.ibm.jms.JMSTextMessage;
    import com.ibm.mq.jms.*;
    import com.ibm.msg.client.wmq.WMQConstants;
    
    import javax.jms.JMSException;
    import javax.jms.Session;
    
    MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
    cf.setHostName("your_IBMMQ_host");
    cf.setPort(1414); // or other port
    cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
    cf.setQueueManager("your_IBMMQ_queue_manager");
    cf.setChannel("your_IBMMQ_channel");
    cf.setStringProperty(WMQConstants.USERID, "your_IBMMQ_username");
    cf.setStringProperty(WMQConstants.PASSWORD, "your_IBMMQ_password");
    connection = (MQQueueConnection) cf.createQueueConnection();
    MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    MQQueue queue = (MQQueue) session.createQueue("queue:///your_IBMMQ_queue");
    MQQueueSender sender = (MQQueueSender) session.createSender(queue);
    JMSTextMessage message = (JMSTextMessage) session.createTextMessage("your_message_body");
    connection.start();
    sender.send(message);
    

More information:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I have tried with code and it is working(i have my code as well) but I am looking for JMS publisher/point-to-point configuration cz for performance test,the code doesnt execute proper from csv file when thread user count is more. I have verified and it picks same entry in csv multiple times.(csv data set config:is true,true,false).I need the script to pick single entry each time even with thread users count two or more. It works that way with publisher but I dont know configuration for IBM MQ in publisher hence stuck. Kindly help – Ajay N Jul 17 '17 at 05:21
0

Depending on your exact requirements, you may be interested by JMSToolBox and its possibility to define scriptsthat will read the payload from csv files stored in a directiory, then create and post them in a MQ Q as a JMS Message from a message template

titou10
  • 2,814
  • 1
  • 19
  • 42