C/C ++中的MQ JMS主题等效 [英] MQ JMS Topic Equivalent in C/C++
问题描述
我对使用TOPICS的MQ并不了解,我已经搜索了IBM文档,也找不到使用C ++订阅主题的方法.在Java中,我已经看到您可以转到Websphere控制面板并在其中进行配置.以编程方式如何在C ++中做到这一点?在C ++中,我使用函数MQCONN,MQOPEN连接到队列,并使用MQGET和MQPUT获取消息,但是我认为我仅连接到队列,而没有主题.如果连接主题与连接队列不同,如果我有正确的主意,我也想弄清楚.在此先感谢大家.
I don't have a clear knowledge about MQ using TOPICS and I have searched in IBM documentation and I can't find the way to subscribe with C++ to a Topic. In Java I have seen that you can go to the Websphere Control Panel and you configure it there. Programmatically how is possible to do it in C++? In C++ I have connected to queues using the functions MQCONN, MQOPEN and to get the messages I use MQGET and MQPUT, but I think I am only connected to queues not TOPICS. I want too to figure it out if I have the correct idea if connect to topic is different than connect to a queue. Thanks in advance guys.
推荐答案
在C ++中进行编程时,建议使用C MQ API,因为C ++类是稳定的,并且不会(也不会)使用主题类进行更新.,按照 IBM知识中心:开发C ++应用程序
It is advisable to use the C MQ API when programming in C++ because the C++ classes are stabilized and have not (and will not) be updated with classes for topics, as per IBM Knowledge Center: Developing C++ applications
IBMWebSphere®MQ版本7.0,对IBM MQ编程接口的增强功能不适用于C ++类.
IBM WebSphere® MQ Version 7.0, enhancements to the IBM MQ programming interfaces are not applied to the C++ classes.
为了使用C MQ API中的主题,这是一个快速的伪代码示例.还请检查IBM提供的示例,例如 amqspuba.c
和 amqssuba.c
.
In order use a topic from the C MQ API here is a quick pseudo-code example. Please also check out the IBM supplied samples, such as amqspuba.c
and amqssuba.c
.
MQOD mqod {MQOD_DEFAULT};
MQCONN...
mqod.ObjectType = MQOT_TOPIC;
mqod.Version = MQOD_VERSION_4; /* To use ObjectString field */
mqod.ObjectString.VSPtr = argv[1];
mqod.ObjectString.VSLength = MQVS_NULL_TERMINATED;
MQOPEN(hConn,
&mqod,
MQOO_OUTPUT,
&hObj,
&CompCode, &Reason);
MQPUT....
订阅主题
MQSD mqsd {MQSD_DEFAULT};
MQCONN...
mqsd.Options = MQSO_CREATE | MQSO_NON_DURABLE | MQSO_MANAGED;
mqsd.ObjectString.VSPtr = argv[1];
mqsd.ObjectString.VSLength = MQVS_NULL_TERMINATED;
MQSUB(hConn,
&mqsd,
&hObj,
&hSub,
&CompCode, &Reason);
MQGET from hObj...
这篇关于C/C ++中的MQ JMS主题等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!