To monitor JMS performance in Spring Boot, add Spring Boot Actuator and a Micrometer registry such as Prometheus, then record the numbers JMS does not give you for free: processing time per message, success and failure counts, and queue depth. Actuator exposes them at /actuator/metrics and /actuator/prometheus, and a dashboard tool such as Grafana turns them into graphs and alerts.
JMS itself has no standard metrics API, so what you can read depends on the broker (ActiveMQ Artemis, IBM MQ, RabbitMQ with its JMS client, Amazon MQ) and on how much you instrument yourself. The approach below works with any broker.
Five signals tell you whether a message-driven service is healthy.
| Metric | What it tells you | Typical alert |
|---|---|---|
| Processing time per message | How long your @JmsListener takes | p95 above your SLA |
| Throughput | Messages handled per second | Sudden drop to zero |
| Queue depth | Backlog waiting on the broker | Growing for several minutes |
| Consumer count | Listeners connected to the queue | Fewer than expected |
| Error and redelivery rate | Failed or retried messages | Rising failure ratio |
Queue depth and consumer count live in the broker. Processing time, throughput and errors live in your application. You need both sides.
Add the Actuator starter and the Micrometer Prometheus registry.
Expose the endpoints you need and tag every metric with the application name so several services can share one dashboard.
Keep the management endpoints on an internal port or behind authentication. Only expose what a scraper needs.
Inject a MeterRegistry and wrap the listener body in a Timer. A counter with an outcome tag gives you success and failure rates from one metric.
The timer already records a count, a total time and a maximum, so you do not need a separate counter. Rethrowing the exception keeps the normal transactional behaviour: the message is rolled back and redelivered according to the broker's policy.
Recent Spring Framework versions (6.1 and later) can also publish Micrometer observations for JMS sends and listener invocations when an ObservationRegistry is configured. Check /actuator/metrics after startup to see which names your version registers before building dashboards on them.
Queue depth is the clearest early warning. You can read it from the broker's JMX or HTTP management API, or ask the broker through JMS with a QueueBrowser. The browser approach works on any broker but scans messages, so use it only on a slow schedule.
Add @EnableScheduling to a configuration class. On a large backlog, prefer the broker's own metrics: Artemis, for example, exposes queue statistics through JMX and offers a Prometheus metrics plugin, and managed brokers publish queue depth to their cloud monitoring service.
Actuator's /actuator/health includes a JMS health indicator that checks the connection to the broker, which is enough for a readiness probe. Pair it with these alerts in Prometheus or Grafana:
jms.consumer.process above your target.jms.consumer.process above a few percent.For request-level visibility, add Micrometer Tracing so trace IDs follow a message from the producer to the listener.
Actuator gives you JVM, HTTP and health metrics out of the box, plus a JMS connection health check. Per-message timings and queue depth need either observations (Spring Framework 6.1 and later) or your own Micrometer code.
Read it from the broker: JMX, the broker's management API or its Prometheus plugin. That avoids scanning messages and works for very large queues.
Yes. The listener timers depend only on JMS and Micrometer. Only the queue depth source changes per broker.
Your listener is probably waiting on a database or remote call. The timer shows total latency, so break it down with tracing or per-dependency timers.
Add Actuator and a Micrometer registry, time every @JmsListener with a Timer tagged by outcome, publish queue depth as a gauge from the broker or a QueueBrowser, and alert on backlog growth, latency and failure ratio. Keep the endpoints private and verify metric names in /actuator/metrics for your version.