Search code examples
jmeterjmsibm-mqjndipoint-to-point

How can JMS Point-to-Point Sampler be used in Jmeter to send messages to an IBM MQ queue


I have a local IBM MQ instance set up with some default queues.

Using JMeter 5.4.1, I first want to send messages to one of these queues to test that the connection works.

1. Is it possible with IBM MQ or does it only work with Active MQ?

The test scenario I wish to achieve is this:

  • JMeter sends some message with ID1 to a queue named "DEV.QUEUE.1"
  • The System under test takes the message from "DEV.QUEUE.1", does some processing and places the response on "DEV.QUEUE.2"
  • JMeter checks and asserts that a response has been received for the message with ID1 on the queue named "DEV.QUEUE.2" within X seconds
  • View results in Aggregate Report

2. Is this achievable with JMS Point-to-Point Sampler?

I've checked the official JMeter documentation, but I don't understand what connection details I need to place in each of the sampler's configuration fields.

JMS Resources
QueueConnection Factory:
JNDI name Request queue:
JNDI name Receive queue:
Number of samples to aggregate
JMS Selector
....
etc...

enter image description here I was able to connect to one queue and send messages using custom code in a JSR223 Sampler. These are the connection details I have used to create the connection:

def hostName = "127.0.0.1"
def hostPort = 1414
def channelName = "DEV.APP.SVRCONN"
def queueManagerName = "QM1"
def queueName = "DEV.QUEUE.1"

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 connInboundQueue = cf.createConnection("mquser", "secretpassword")
def sessInboundQueue = connInboundQueue.createSession(false, Session.AUTO_ACKNOWLEDGE)
def destinationInboundQueue = sessInboundQueue.createQueue(queueName)
connInboundQueue.start()

I'm guessing that I can map these connection credentials to this JMS Point-to-Point Sampler so that I can achieve the same connection, I just don't know how.

So to sum up:

1a. How can I achieve connection to my two queues using the JMS Point-to-Point Sampler?

2a. How can the JMS Point-to-Point Sampler be configured for the scenario I have described above?

I would appreciate any help.


Solution

  • I don't think it's currently possible, the options are in:

    1. Use mqmeter - MQ JMeter Extension, it will provide a custom Java Request sampler
    2. Continue with JSR223 Test Elements, example producer and consumer code snippets can be found in IBM MQ testing with JMeter - Learn How article