Skip to content

Commit

Permalink
mqmetric - MQ93 enables reformatted subscriptions for resource metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ibmmqmet committed Nov 13, 2023
1 parent a0c1e63 commit 22013e4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
Newest updates are at the top of this file.

## Nov 13 2023 - v5.5.3
- mqmetric - MQ 9.3 permits resource subscriptions for queues with '/' in name

## Nov 08 2023 - v5.5.2
- ibmmq - #204 data race fix
- mqmetric - deal with empty QueueSubFilter option
Expand Down
22 changes: 15 additions & 7 deletions mqmetric/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,15 +751,15 @@ func discoverQueues(monitoredQueuePatterns string) error {
var ok bool
qName := strings.TrimSpace(qList[i])

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

0 comments on commit 22013e4

Please sign in to comment.