【发布时间】:2021-08-02 18:31:31
【问题描述】:
我是 IBM MQ 的新手,我已按照JMETER IBM MQ Testing中提到的步骤成功连接到 IBM MQ。在这个链接中,我可以看到行中提到的字符串
def payload = String.format("JMeter...IBM MQ...test message no. %09d!", rnd.nextInt(Integer.MAX_VALUE))
反映的是 IBM MQ。
现在,我的问题是,如何将 content/xml 文件发送到 IBM MQ。
-
在 JSR223 Sampler 中使用以下代码获取文件,
import org.apache.jmeter.util.JMeterUtils; String fileContents = new File('./test.xml').getText('UTF-8'); vars.put("content",fileContents); -
在 JSR223 Sampler 中使用的代码 sn-p 发送 xml,
def payload = vars.get("content");
def msg = sess.createTextMessage(payload)})
def start = Instant.now()
producer.send(msg)
通过这样做,响应消息:javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script4.groovy:15:意外输入:'"' @ 第 15 行,第 34 列。 def payload = " 被观察到。
请帮助我如何使用 JMETER 将 xml 发送到 IBM MQ。
【问题讨论】: