[英]How to connect to IBM MQ from JMS publisher without JNDI properties?
I have been trying to connect to IBM MQ from JMeter JMS publisher. 我一直在尝试从JMeter JMS发布者连接到IBM MQ。 Unable to find corrert "Initial context factory" and "connection factory" values to use without JNDI properties.
无法找到更正的“初始上下文工厂”和“连接工厂”值以在没有JNDI属性的情况下使用。 I have all MQ jars present in LIB folder.
我的LIB文件夹中存在所有MQ罐。
I have the following information-host name - Venus, Port - 21717, Destination Queue name - request.queue,Queue manager - venus.QMGR,channel - venus.server.chl (no authorization required). 我具有以下信息主机名-Venus,端口-21717,目标队列名称-request.queue,队列管理器-venus.QMGR,通道-venus.server.chl(无需授权)。
My requirement - To connect to IBM MQ using JMS publisher with above details. 我的要求-使用具有上述详细信息的JMS Publisher连接到IBM MQ。 But I am not able to sort out on what to give for Provider URL, Initial context factory and connection factory.
但是我无法弄清楚要提供的提供商URL,初始上下文工厂和连接工厂。 Can you please help as this has been bugging me for past two weeks and couldn't find a solution yet?
您能帮上忙吗,因为这已经困扰了我两周了,还找不到解决方案? It would be great if you can tell me on where to populate the above values in JMS publisher as well for connecting to IBM MQ.
如果您能告诉我有关在JMS Publisher中填充上述值以及连接到IBM MQ的位置的信息,那将很好。
I have tried with user.classpath=/folder/with/mq/jars as well but it is not working and all jars are in place with JMeter restart still no luck. 我也尝试过使用user.classpath = / folder / with / mq / jars,但是它不起作用,并且所有的jar都在适当的位置,JMeter重新启动仍然没有运气。
Note: I have gone through all sites in these two weeks but couldn't get any luck. 注意:这两个星期我浏览了所有站点,但没有任何运气。
Example configuration steps would be something like: 示例配置步骤如下所示:
Put the following code into "Script" area: 将以下代码放入“脚本”区域:
import com.ibm.jms.JMSTextMessage; import com.ibm.mq.jms.*; import com.ibm.msg.client.wmq.WMQConstants; import javax.jms.JMSException; import javax.jms.Session; MQQueueConnectionFactory cf = new MQQueueConnectionFactory(); cf.setHostName("your_IBMMQ_host"); cf.setPort(1414); // or other port cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT); cf.setQueueManager("your_IBMMQ_queue_manager"); cf.setChannel("your_IBMMQ_channel"); cf.setStringProperty(WMQConstants.USERID, "your_IBMMQ_username"); cf.setStringProperty(WMQConstants.PASSWORD, "your_IBMMQ_password"); connection = (MQQueueConnection) cf.createQueueConnection(); MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); MQQueue queue = (MQQueue) session.createQueue("queue:///your_IBMMQ_queue"); MQQueueSender sender = (MQQueueSender) session.createSender(queue); JMSTextMessage message = (JMSTextMessage) session.createTextMessage("your_message_body"); connection.start(); sender.send(message);
More information: 更多信息:
根据您的确切要求,您可能会对JMSToolBox感兴趣,它可能会定义scripts
来从存储在目录中的csv
文件中读取有效负载,然后将其创建并作为消息模板中的JMS消息发布到MQ Q中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.