简体   繁体   English

如何在 Jmeter 中使用 JMS Point-to-Point Sampler 将消息发送到 IBM MQ 队列

[英]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.我有一个设置了一些默认队列的本地 IBM MQ 实例。

Using JMeter 5.4.1, I first want to send messages to one of these queues to test that the connection works.使用 JMeter 5.4.1,我首先想将消息发送到这些队列之一以测试连接是否有效。

1. Is it possible with IBM MQ or does it only work with Active MQ? 1. 是否可以与 IBM MQ 一起使用,还是只能与 Active MQ 一起使用?

The test scenario I wish to achieve is this:我希望实现的测试场景是这样的:

  • JMeter sends some message with ID1 to a queue named "DEV.QUEUE.1" JMeter 将一些带有 ID1 的消息发送到名为“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"被测系统从“DEV.QUEUE.1”获取消息,进行一些处理并将响应放在“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 JMeter 检查并断言已在 X 秒内收到名为“DEV.QUEUE.2”的队列上 ID1 消息的响应
  • View results in Aggregate Report在汇总报告中查看结果

2. Is this achievable with JMS Point-to-Point Sampler? 2. 这可以通过 JMS 点对点采样器实现吗?

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.我已经查看了官方的 JMeter 文档,但我不明白我需要在每个采样器的配置字段中放置哪些连接详细信息。

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

在此处输入图片说明 I was able to connect to one queue and send messages using custom code in a JSR223 Sampler.我能够连接到一个队列并使用 JSR223 采样器中的自定义代码发送消息。 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.我猜我可以将这些连接凭据映射到这个 JMS 点对点采样器,以便我可以实现相同的连接,我只是不知道如何。

So to sum up:所以总结一下:

1a. 1a. How can I achieve connection to my two queues using the JMS Point-to-Point Sampler?如何使用 JMS 点对点采样器连接到我的两个队列?

2a. 2a. How can the JMS Point-to-Point Sampler be configured for the scenario I have described above?如何为我上面描述的场景配置 JMS 点对点采样器?

I would appreciate any help.我将不胜感激任何帮助。

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使用mqmeter - MQ JMeter 扩展,它将提供一个自定义的Java 请求采样器
  2. Continue with JSR223 Test Elements, example producer and consumer code snippets can be found in IBM MQ testing with JMeter - Learn How article继续使用 JSR223 测试元素,可以在IBM MQ testing with JMeter - Learn How文章中找到示例生产者和消费者代码片段

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM