I am new to IBM MQ and I have followed the steps mentioned in JMETER IBM MQ Testingand successfully connected to the IBM MQ. In this link, I could see the string mentioned in the line
def payload = String.format("JMeter...IBM MQ...test message no. %09d!", rnd.nextInt(Integer.MAX_VALUE))
is reflecting the IBM MQ.
Now, my question here is, how to send the content/xml file to the IBM MQ.
Fetching the file using the below code in JSR223 Sampler,
import org.apache.jmeter.util.JMeterUtils;
String fileContents = new File('./test.xml').getText('UTF-8');
vars.put("content",fileContents);
Code snippet used in JSR223 Sampler to send the xml,
def payload = vars.get("content");
def msg = sess.createTextMessage(payload)})
def start = Instant.now()
producer.send(msg)
By doing this, Response message:javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script4.groovy: 15: Unexpected input: '"' @ line 15, column 34. def payload = " is observed.
Kindly help me how can I achieve sending xml to IBM MQ using JMETER.
Looks like a typo:
def msg = sess.createTextMessage(payload)})
^here
just change it to
def msg = sess.createTextMessage(payload)
and it should start working as expected.
Just in case: