简体   繁体   English

IBM MQ从订阅队列中的消息获取主题名称

[英]IBM MQ get topic name from message in subscription queue

I am using 'c-client' api to access the Websphere IBM MQ 8 . 我使用'c-client'api来访问Websphere IBM MQ 8 Is it possible to identify the source topic from which the message was published ? 是否可以确定发布消息的源主题?

To inquire on the topic string, use the MQCRTMH API call to obtain a message handle, then inquire the properties of the message using the MQINQMP API call specifying the MQTopicString property. 要查询主题字符串,请使用MQCRTMH API调用来获取消息句柄,然后使用指定MQTopicString属性的MQINQMP API调用来查询MQTopicString属性。

MQCRTMH - Create message handle MQCRTMH - 创建消息句柄
MQINQMP - Property Names MQINQMP - 属性名称
Sample IBM MQ procedural programs IBM MQ过程程序示例

Admittedly, it can be difficult to track this info down in the IBM MQ reference documentation, especially if you do not already know the way it works and the names of the calls and fields. 不可否认,在IBM MQ参考文档中跟踪此信息可能很困难,特别是如果您还不知道它的工作方式以及调用和字段的名称。 One approach that can help is to start with the sample programs to get a basic understanding and then work back into the manuals to fill in the missing details. 一种可以提供帮助的方法是从示例程序开始,以获得基本的理解,然后回到手册中以填补缺失的细节。 The sample code is available from the install media by selecting the appropriate optional component. 通过选择适当的可选组件,可从安装介质中获取示例代码。

On Windows these end up in {MQM Home}/Tools and on UNIX systems at {MQM Home}/samp . 在Windows上,这些最终位于{MQM Home}/Tools和UNIX系统上的{MQM Home}/samp If the samples are installed, AMQSIQMA will demonstrate how to inquire properties of a message handle, and is an example of the use of the MQINQMP API call. 如果安装了示例, AMQSIQMA将演示如何查询消息句柄的属性,并且是使用MQINQMP API调用的示例。

To inquire on the topic string, use the MQCRTMH API call to obtain a message handle, then inquire the properties of the message using the MQINQMP API call specifying the MQTopicString property. 要查询主题字符串,请使用MQCRTMH API调用来获取消息句柄,然后使用指定MQTopicString属性的MQINQMP API调用来查询消息的属性。

The correct message property name is 'mqps.Top' (case sensitive & no quotes). 正确的消息属性名称是'mqps.Top'(区分大小写并且没有引号)。

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

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