0
votes

I want to send message to a remote IBM MQ using Jmeter for performance testing. I went through this link. But it requires the JNDI specific details like, QueueConnection Factory, JNDI Name Request queue, Initial Context Factory & Provider URL. Whereas the queu details i have are Qmanager, Qname, hostname, channel, port as given in the code shared in this link. Do these properties have any relation? Can i configure the Jmeter JMS test using the queue details i have?

Thanks in advance.

2
Ayushi, Did you find an easy way to make this work? Thanks in advance!mandy
Mandy, i did not find any way to make it work. Moreover, this wasn't required later on in my project, so stopped looking for the solution.Ayushi
Ayushi, Thanks a lot for responding. Btw, I was able to make this work using the directions provided in link. the only addition is that i had to copy all the MQ jars from Websphere MQ installation into JMeter/lib.mandy

2 Answers

1
votes

The first link you gave has a description using Java JMS/MQ and the second shows Java MQ (non-JMS).

JMS is just an abstraction layer. In simple terms, JMS is like giving everything a nick-name. A QCF (QueueConnectionFactory) is simply an object that has all of the information to connect to a queue manager.

i.e.

DEFINE QCF(myQCF) QMANAGER(MQWT1) CHANNEL(TEST.CHL) HOSTNAME(127.0.0.1) PORT(1415) TRANSPORT(CLIENT) FAILIFQUIESCE(YES)

A JMS queue is just a nick-name to an MQ queue.

DEFINE Q(test.q) QUEUE(TEST.Q1) QMANAGER(MQWT1) TARGCLIENT(JMS) FAILIFQUIESCE(YES)

Therefore, in your JMS code you simply reference your QCF (i.e. myQCF) and the JMS queue (i.e. test.q) and you are good to go.

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
env.put(Context.PROVIDER_URL, ""file:/C:/JNDI-Directory");

try
{
   Context ctx = new InitialContext(env);

   QueueConnectionFactory cf = (QueueConnectionFactory) ctx.lookup("myQCF");
   Queue q = (Queue) ctx.lookup("test.q");
}
catch (NamingException e)
{
   System.err.println(e.getLocalizedMessage());
   e.printStackTrace();
}
0
votes

It can be done via the beanshell as well. You can directly access the queue manager via the api, or via exposing the queue via a jms binding. The first is more simple and does not require the MQ client installation.