問題描述
如何配置 IIB 10 以將 monitoring_event 消息作為持久性 MQ 隊列發布? (How to configure IIB 10 to publish monitoring_event messages as persisitent to persistent MQ queue?)
我想配置 IIB 10 和 MQ 8,以便將發布的監控事件消息保留在持久 MQ 隊列中。
手冊位於:https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0 /com.ibm.etools.mft.doc/ac37850_.htm 有一個註釋要說:
Publications 默認情況下解析為 nonpersistent,但您可以將發布更改為通過在 WebSphere® MQ 中配置命名主題來持久化。有關更多信息,請參閱 中的訂閱和消息持久性主題 在線 WebSphere MQ 版本 7.5 產品文檔。
不幸的是,這個對舊版本 MQ 的奇怪參考毫無用處。
我瀏覽了 MQ 手冊它在資源管理器中定義主題定義中的字段並且沒有幫助,因為“默認持久性”要求發布者使用 MQPER_PERSISTENCE_AS_Q_DE
F。由於 IIB 的默認值是“非持久性”,我不得不假設它不使用它。
如果有人能告訴我如何覆蓋它並將持久性消息寫入持久性,我將不勝感激隊列。
FWIW 我最初認為將隊列定義為持久接收事件消息可以解決問題 ‑ 但事實並非如此。下一個,
參考解法
方法 1:
You mentioned the docs state "Publications resolve to be nonpersistent by default", this does not mean that they use MQPER_NOT_PERSISTENT
, likely they use MQPER_PERSISTENCE_AS_Q_DEF
or specify nothing at all in which case it defaults to the same as if MQPER_PERSISTENCE_AS_Q_DEF
was specified.
The problem is with your topic string. A TOPIC object is a anchor to a leaf in the tree. It applies to anything below that leaf unless a more specific TOPIC object applies. So in your case the string should be $SYS/Broker/int‑sver/monitoring
with out the /+/+
at the end.
+
is a wildcard and wildcards only come into play on subscriptions not on topics.
You can find more information in the IBM MQ v8.0 Knowledge Center page IBM MQ>Technical overview>IBM MQ objects>Object types>Topic objects:
A topic object is an IBM® MQ object that allows you to assign specific, non‑default attributes to topics.
A topic is defined by an application publishing or subscribing to a particular topic string. A topic string can specify a hierarchy of topics by separating them with a forward slash character (/). This can be visualized by a topic tree. For example, if an application publishes to the topic strings /Sport/American Football and /Sport/Soccer, a topic tree will be created that has a parent node Sport with two children, American Football, and Soccer.
Topics inherit their attributes from the first parent administrative node found in their topic tree. If there are no administrative topic nodes in a particular topic tree, then all topics will inherit their attributes from the base topic object, SYSTEM.BASE.TOPIC.
You can create a topic object at any node in a topic tree by specifying that node's topic string in the TOPICSTR attribute of the topic object. You can also define other attributes for the administrative topic node. For more information about these attributes, see the The MQSC commands, or the Automating administration tasks. Each topic object will, by default, inherit its attributes from its closest parent administrative topic node.
topic objects can also be used to hide the full topic tree from application developers. If a topic object named FOOTBALL.US is created for the topic /Sport/American Football, an application can publish or subscribe to the object named FOOTBALL.US instead of the string /Sport/American Football with the same result.
If you enter a #, +, /, or * character within a topic string on a topic object, the character is treated as a normal character within the string, and is considered to be part of the topic string associated with a topic object.
For more information about topic objects, see Publish/subscribe messaging.
The closest page I could find to the link in the IIB KC on MQ v8.0 is the IBM MQ Knowledge Center page IBM MQ>Developing applications>Developing MQI applications with IBM MQ>Writing a procedural application for queuing>Writing publish/subscribe applications>Subscription options:
Message persistence ‑‑
Queue managers maintain the persistence of the publications they forward to subscribers as set by the publisher. The publisher sets the persistence to be one of the following options:
0
Nonpersistent1
Persistent2
Persistence as queue/topic definitionFor publish/subscribe, the publisher resolves the topic object and topicString to a resolved topic object. If the publisher specifies Persistence as queue/topic definition, then the default persistence from the resolved topic object is set for the publication.
方法 2:
This article explains how to generate and subscribe to broker generated event messages. It is not in the text, but I think the generates messages are persistent.
https://www.ibm.com/developerworks/websphere/library/techarticles/0911_fan/0911_fan.html
At the subscription queue one could also set DEFPSIST(YES)
(by John Ormerod、JoshMc、matjung)