Search code examples
jmeter

How can i take a message from MQ WEb server and Use it in the body of my API Post request


Question in Regards to the following Scenario:

  1. I have a Jmeter script that will authorize user by generating token and using that token to send the request to an api endpoint.. that will process a claim and send back a results.

The Body Request is in XML format.....There are over half a million Record or claims that we have in our dataset which is stored in a database. This record was extracted as messages and placed on an MSMQ ....... I want to have my Jmeter script that would take the message from the queue and use that as the body of the request. How can i do that? or is there a suggestion to do something else?

enter image description here

enter image description here


Solution

  • JMeter provides JMS Subscriber which can connect to message queuing systems via JMS and fetch messages from the queue/topic.

    In edge cases like IBM MQ you won't be able to use JMS Subscriber, you will need to write some Groovy code in JSR223 Test Elements like it's described in IBM MQ Tutorial: Learn How to Testing With JMeter

    If by MSMQ you mean Microsoft Message Queuing (I don't think this is the case however) you will need to use a 3rd-party library like this one

    Once you get the message from the queue you will be able to store it into a JMeter Variable and use in the subsequent requests.