简体   繁体   English

如何从没有JNDI属性的JMS发布者连接到IBM MQ?

[英]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: 示例配置步骤如下所示:

  1. Add javax.jms-api.-xxx jar to JMeter Classpath javax.jms-api.-xxx jar添加到JMeter Classpath
  2. Add mq-allclient-xxxxjar to JMeter Classpath mq-allclient-xxxxjar添加到JMeter类路径
  3. Add JSR223 Sampler to your Test Plan JSR223采样器添加到您的测试计划
  4. 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.

相关问题 尝试在jmeter中使用jms发布者/订阅者连接到IBM MQ - Trying to use jms publisher/subscriber in jmeter to connect to IBM MQ JMeter JMS 发布者 IBM MQ Java.lang.NoClassDefFoundError - JMeter JMS Publisher IBM MQ Java.lang.NoClassDefFoundError Jmeter JMS点对点连接IBM MQ错误(java.lang.IllegalStateException:预期为QueueConnectionFactory,但是得到了com.ibm.mq.jms - Jmeter JMS point to point to connect IBM MQ error ( java.lang.IllegalStateException: QueueConnectionFactory expected, but got com.ibm.mq.jms Jmeter连接到IBM MQ - Jmeter to connect to IBM MQ Jmeter - JMS Publisher - 如何从 XML 请求中获取值 - Jmeter - JMS Publisher - How to get the value from XML request 如何解决javax.naming.NameNotFoundException:JMeter中的com.ibm.mq.jms.MQQueueConnectionFactory错误 - How to resolve javax.naming.NameNotFoundException: com.ibm.mq.jms.MQQueueConnectionFactory error in JMeter 如何在 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 如何解决JMS发布者问题? - How to resolve the JMS publisher issue? JMeter IBM MQ JMS点对点测试获取NumberFormatException - JMeter IBM MQ JMS Point-to-Point test getting NumberFormatException 如何使用 JMS Publisher 和 JMS Subscriber 为 JMeter 中的订阅者过滤来自 ActiveMQ 的响应消息 - How to filter response messages from ActiveMQ for subscribers in JMeter using JMS Publisher and JMS Subscriber
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM