test IBM MQ with mqmeter

MQ JMeter Extension.

github:GitHub - JoseLuisSR/mqmeter: MQ JMeter Extension.

JMeter Plugin to put and get message on IBM MQ Queue, also publish message on Topic. It connect to MQ Server through server channel using ip address, port number, userID and password (if the channel has CHLAUTH rules).

Install

Build the extension:

mvn package

Install the extension mqmeter-x.y.z.jar into

`$JMETER_HOME/lib/ext`.

Also you can install it through JMeter Plugins, search "IBM MQ Support".

Usage

After installing mqmeter, you can choose two kind of Java Sampler, these are:

MQClientSampler

Use it to put and get message (optional) on MQ queue. On JMeter add a Java Request Sampler and select the MQClientSampler class name. The following parameter are necessary.

  • mq_manager: MQ Manager name. You can find it through IBM WebSphere MQ Explore or console.
  • mq_queue_put: MQ Queue name to put message. Could be Local or Remote queue.
  • mq_queue_get: MQ Queue name to get message. Could be Local or Remote queue. Leave it empty if you don't want get response message.
  • mq_correlate_msg: Correlate the response message with request message to get the right message from the queue. Put 'messageId' or 'correlationId' values. Leave it empty if you don't want get response message.
  • mq_wait_interval: Set wait interval that the get message call waits for a suitable message to arrive. Similar to time-out to get response message on queue.
  • mq_hostname: Host name or ip address where MQ Server is running.
  • mq_port: Port number of the MQ Server listener.
  • mq_channel: The Server channel name on MQ Server.
  • mq_user_id: The userID to connect to MQ server channel. Leave it empty if you don't need user id to connect to MQ.
  • mq_user_password: The user password to connect to MQ server channel. Leave it empty if you don't need user id and password to connect to MQ.
  • mq_use_mqcsp_authentication: The connection authentication used. Set false for Compatibility mode, or true for MQCSP authentication.
  • mq_encoding_message: Character encoding standard for your message: For EBCDIC put Cp1047. ASCII just put ASCII.
  • mq_message: The content of the message that you want.

Put & Get Message on Queue

Put Message on Queue

MQPublishSampler

MQ can manage topics also and you can publish and subscribe to it, use this class to publish message on MQ Topic. On JMeter add a Java Request Sampler and select the MQPublishSampler class name. The following parameters are necessary.

  • mq_manager: MQ Manager name. You can find it through IBM WebSphere MQ Explore or console.
  • mq_topic: MQ topic name to publish message.
  • mq_hostname: Host name or ip address where MQ Server is running.
  • mq_port: Port number of the MQ Server listener.
  • mq_channel: The Server channel name on MQ Server.
  • mq_user_id: The userID to connect to MQ server channel. Leave it empty if you don't need user id to connect to MQ.
  • mq_user_password: The user password to connect to MQ server channel. Leave it empty if you don't need user id and password to connect to MQ.
  • mq_encoding_message: Character encoding standard for your message: For EBCDIC put Cp1047. ASCII just put ASCII.
  • mq_message: The content of the message that you want.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
IBM MQ 配置 JNDI 的步骤如下: 1. 首先,需要创建一个 JNDI 上下文,可以使用 `InitialContext` 类来创建。例如: ```java Hashtable<String, String> env = new Hashtable<>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); env.put(Context.PROVIDER_URL, "file:///C:/jndi"); Context context = new InitialContext(env); ``` 上面的代码创建了一个文件系统上下文,路径为 `C:/jndi`。 2. 在 JNDI 上下文中绑定 MQ 连接工厂和队列。 ```java // 创建 MQ 连接工厂 MQConnectionFactory cf = new MQConnectionFactory(); cf.setHostName("localhost"); cf.setPort(1414); cf.setQueueManager("QMGR"); cf.setChannel("SYSTEM.DEF.SVRCONN"); // 将 MQ 连接工厂绑定到 JNDI 上下文 context.bind("jms/CF", cf); // 创建队列,将队列绑定到 JNDI 上下文 MQQueue queue = new MQQueue("queue:///TEST.QUEUE"); context.bind("jms/QUEUE", queue); ``` 上面的代码创建了一个 MQ 连接工厂,然后将其绑定到 JNDI 上下文中的 `jms/CF` 名称下。同时,还创建了一个队列,并将其绑定到 `jms/QUEUE` 名称下。 3. 在应用程序中通过 JNDI 获取 MQ 连接工厂和队列。 ```java // 从 JNDI 上下文中获取 MQ 连接工厂 MQConnectionFactory cf = (MQConnectionFactory) context.lookup("jms/CF"); // 从 JNDI 上下文中获取队列 MQQueue queue = (MQQueue) context.lookup("jms/QUEUE"); ``` 上面的代码从 JNDI 上下文中获取了 MQ 连接工厂和队列。 以上就是 IBM MQ 配置 JNDI 的基本步骤。具体的细节还需要根据实际情况进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

saber872138

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值