Skip to content

Add IBM MQ broker throughput collection#5463

Draft
ramonsmits wants to merge 2 commits intomasterfrom
ibmmq-broker-throughput
Draft

Add IBM MQ broker throughput collection#5463
ramonsmits wants to merge 2 commits intomasterfrom
ibmmq-broker-throughput

Conversation

@ramonsmits
Copy link
Copy Markdown
Member

@ramonsmits ramonsmits commented May 7, 2026

Summary

  • Implements IBrokerThroughputQuery for the IBM MQ transport so the licensing component's daily throughput collection covers IBM MQ deployments. Statistics are read from SYSTEM.ADMIN.STATISTICS.QUEUE (configurable) and aggregated per UTC day from MQIAMO_GETS counters inside MQGACF_Q_STATISTICS_DATA PCF groups.
  • Hand-rolled binary PCF parser walks the wire format directly via MQMessage.ReadInt4/ReadInt8/ReadString/SkipBytes. The IBM .NET MQ client (amqmdnetstd.dll v9.4.5) does not implement MQCFGR group-parameter parsing — new PCFMessage(MQMessage) throws "Unknown type" on every statistics message, so the documented .NET API can't be used.
  • Two settings expose multi-consumer flexibility:
    • LicensingComponent/IBMMQ/StatisticsQueue — source queue override, for setups where another tool already drains SYSTEM.ADMIN.STATISTICS.QUEUE and a forwarder, MQ topic subscription, or cluster channel delivers a per-consumer copy to a dedicated queue.
    • LicensingComponent/IBMMQ/StatisticsForwardingQueue — when set, ServiceControl re-publishes each consumed statistics message verbatim to a downstream queue inside the same syncpoint. Mirrors NServiceBus error/audit forwarding semantics.
  • When STATQ is disabled on the queue manager, ServiceControl still starts and runs; audit-based throughput collection acts as the fallback. Connection-time validation (broker reachability, STATQ enablement, stats-queue access) is deferred from InitializeCore to TestConnectionCore and the first GatherThroughput cycle so host startup never blocks on broker I/O.
  • Docs PR: Document IBM MQ broker throughput collection docs.particular.net#8244

Test plan

  • 9 unit tests covering settings parsing, diagnostics output, no-connection error
  • 3 integration tests against a real IBM MQ broker (Podman icr.io/ibm-messaging/mq:latest):
    • drain returns dequeue counts matching MQIAMO_GETS
    • forwarding republishes a verbatim copy of each stats message
    • TestConnection reports an actionable error when STATQ(OFF)
  • 17 pre-existing IBM MQ tests still pass
  • 19 transport-abstraction approval tests still pass
  • Full solution builds with 0 warnings, 0 errors
  • Smoke test against the ibmmq-bridge-demo workload using the CI-published pr- image

Implements IBrokerThroughputQuery for the IBM MQ transport so the
licensing component's daily throughput collection can include IBM MQ
deployments. Per-queue daily totals are aggregated from MQIAMO_GETS
counters inside MQGACF_Q_STATISTICS_DATA groups in PCF statistics
messages drained from SYSTEM.ADMIN.STATISTICS.QUEUE (configurable).

The IBM .NET MQ client (amqmdnetstd.dll v9.4.5) does not implement
MQCFGR group-parameter parsing, so a hand-rolled binary PCF parser
walks the wire format directly using MQMessage.ReadInt4/ReadInt8/etc.

Two settings expose multi-consumer flexibility:
- IBMMQ/StatisticsQueue overrides the source queue, for setups where
  another tool already drains SYSTEM.ADMIN.STATISTICS.QUEUE and a
  forwarder or topic subscription delivers a per-consumer copy.
- IBMMQ/StatisticsForwardingQueue causes ServiceControl to re-publish
  each consumed statistics message verbatim to a downstream queue in
  the same syncpoint, so a second consumer reads its own copy.

When STATQ is disabled on the queue manager, ServiceControl still
starts and runs; audit-based throughput collection acts as the
fallback. All connection-time validation (broker reachability, STATQ
enablement, stats-queue access) is deferred to TestConnectionCore and
the first GatherThroughput cycle so InitializeCore does not block on
broker I/O during host startup.

Verified by 9 unit tests and 3 integration tests against a real
IBM MQ broker (Podman icr.io/ibm-messaging/mq:latest).

The trailing-newline removals on ConnectionProperties.cs,
DeadLetterQueueCheck.cs and QueueLengthProvider.cs are an incidental
side effect of running dotnet format over the project to satisfy the
.editorconfig setting insert_final_newline = false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants