Skip to content

Commit 22013e4

Browse files
committed
mqmetric - MQ93 enables reformatted subscriptions for resource metrics
1 parent a0c1e63 commit 22013e4

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
Newest updates are at the top of this file.
33

4+
## Nov 13 2023 - v5.5.3
5+
- mqmetric - MQ 9.3 permits resource subscriptions for queues with '/' in name
6+
47
## Nov 08 2023 - v5.5.2
58
- ibmmq - #204 data race fix
69
- mqmetric - deal with empty QueueSubFilter option

mqmetric/discover.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,15 +751,15 @@ func discoverQueues(monitoredQueuePatterns string) error {
751751
var ok bool
752752
qName := strings.TrimSpace(qList[i])
753753

754-
// If the qName contains a '/' - eg "DEV/QUEUE/1" then the queue manager will
755-
// not (right now) process resource publications correctly. Hopefully that will get
756-
// fixed at some point, but we will issue a warning here. The same problem happens with
757-
// amqsrua; there's no workround possible outside of the qmgr code.
754+
// If the qName contains a '/' - eg "DEV/QUEUE/1" then the queue manager cannot
755+
// process resource publications by simply inserting the qName because it disrupts
756+
// the topic string pattern. This was fixed in the queue manager by 9.3.0 by allowing
757+
// the subscriptions to use '&' in place of the '/' character.
758758
//
759-
// Because of the possible complexities of pattern matching, we don't
759+
// For older levels of MQ, because of the possible complexities of pattern matching, we don't
760760
// actually fail the discovery process, but instead issue a warning and continue with
761761
// other queues.
762-
if strings.Contains(qName, "/") && ci.globalSlashWarning == false {
762+
if strings.Contains(qName, "/") && ci.globalSlashWarning == false && GetCommandLevel() < ibmmq.MQCMDL_LEVEL_930 {
763763
ci.localSlashWarning = true // First time through, issue the warning for all queues
764764
logError("Warning: Cannot subscribe to queue containing '/': %s", qName)
765765
continue
@@ -1038,7 +1038,15 @@ func createSubscriptions() error {
10381038
delete(ty.subHobj, key)
10391039
}
10401040
} else {
1041-
topic := fmt.Sprintf(ty.ObjectTopic, key)
1041+
// Convert embedded "/" to "&" in the topic subscriptions, provided
1042+
// we are at MQ 9.3. The maps referring to the topic still keep the "/" in
1043+
// the key for maps referring to the object; we don't need the modified topic name
1044+
// outside of the initial subscription.
1045+
keyDeslashed := key
1046+
if GetCommandLevel() >= ibmmq.MQCMDL_LEVEL_930 {
1047+
keyDeslashed = strings.Replace(key, "/", "&", -1)
1048+
}
1049+
topic := fmt.Sprintf(ty.ObjectTopic, keyDeslashed)
10421050
if usingDurableSubs {
10431051
mqtd, err = subscribeDurable(topic, &ci.si.replyQObj)
10441052
} else {

0 commit comments

Comments
 (0)