Class JMSMetrics
java.lang.Object
io.micronaut.jms.metrics.JMSMetrics
- All Implemented Interfaces:
io.micronaut.core.order.Ordered, JMSMessageObserver
@Singleton
@Requires(classes=io.micrometer.core.instrument.MeterRegistry.class) @Requires(beans=io.micrometer.core.instrument.MeterRegistry.class) @Requires(property="micronaut.metrics.binders.jms.enabled",notEquals="false")
public final class JMSMetrics
extends Object
implements JMSMessageObserver
Records the messages that JMS listeners process and that JMS producers send. Listener messages are counted as
"jms.listener.messages" and timed as "jms.listener.duration", from the start of the listener method to the
end of the success or error handlers. Producer messages are counted as "jms.producer.messages" and timed as
"jms.producer.duration", from taking the connection to the commit of a transacted send, so a send that fails
to connect is counted as a failure too. The meters are tagged with the
destination and the result, success or failure, and failures with the
exception class. Disable them with micronaut.metrics.binders.jms.enabled: false.- Since:
- 5.2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property that disables the metrics.static final StringThe name of the timer of the messages that listeners process.static final StringThe name of the counter of the messages that listeners process.static final StringThe name of the timer of the messages that producers send.static final StringThe name of the counter of the messages that producers send.Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Method Summary
Modifier and TypeMethodDescriptionintgetOrder()process(JMSDestinationType destinationType, String destination, jakarta.jms.Message message) Called before a listener processes a message: before the listener method and the success and error handlers.send(JMSDestinationType destinationType, String destination) Called before a producer sends a message, before the connection is taken from the pool and the message is created, so a send that fails to connect is observed too.
-
Field Details
-
ENABLED
-
LISTENER_MESSAGES
The name of the counter of the messages that listeners process.- See Also:
-
LISTENER_DURATION
The name of the timer of the messages that listeners process.- See Also:
-
PRODUCER_MESSAGES
The name of the counter of the messages that producers send.- See Also:
-
PRODUCER_DURATION
The name of the timer of the messages that producers send.- See Also:
-
-
Method Details
-
process
public JMSObservation process(JMSDestinationType destinationType, String destination, jakarta.jms.Message message) Description copied from interface:JMSMessageObserverCalled before a listener processes a message: before the listener method and the success and error handlers.- Specified by:
processin interfaceJMSMessageObserver- Parameters:
destinationType- The type of the destinationdestination- The name of the destination the listener consumes frommessage- The message- Returns:
- The observation to complete once the message is processed, or
null
-
send
Description copied from interface:JMSMessageObserverCalled before a producer sends a message, before the connection is taken from the pool and the message is created, so a send that fails to connect is observed too. Once the message is created and its headers are set, the observation'sJMSObservation.beforeSend(Message)is called with it, so properties added to the message are sent with it.- Specified by:
sendin interfaceJMSMessageObserver- Parameters:
destinationType- The type of the destinationdestination- The name of the destination the message is sent to- Returns:
- The observation to complete once the message is sent or the send failed, or
null
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceio.micronaut.core.order.Ordered
-