Package io.micronaut.jms.model
Class JMSHeaders
java.lang.Object
io.micronaut.jms.model.JMSHeaders
Utility class for access to the supported JMS Headers, and methods to
extract those values from a given
Message
.- Since:
- 1.0.0
- Author:
- Elliott Pope
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name of the Correlation ID header.static final String
Name of the Delivery Mode header.static final String
Name of the Delivery Time header.static final String
Name of the Destination header.static final String
Name of the Expiration header.static final String
Name of the ID header.static final String
Name of the Priority header.static final String
Name of the Redelivered header.static final String
Name of the Reply To header.static final String
Name of the Timestamp header.static final String
Name of the Type header. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
Attempts to retrieve the value of the header given byheaderName
from the givenmessage
.static boolean
isJMSHeader
(String headerName)
-
Field Details
-
JMS_CORRELATION_ID
Name of the Correlation ID header. Specifies an ID so theMessage
can be linked to other messages.- See Also:
-
Message.getJMSCorrelationID()
- Constant Field Values
-
JMS_DELIVERY_MODE
Name of the Delivery Mode header.- See Also:
-
Message.getJMSDeliveryMode()
- Constant Field Values
-
JMS_DELIVERY_TIME
Name of the Delivery Time header. Note: Only available when using a JMS 2.0 provider.- See Also:
-
Message.getJMSDeliveryTime()
- Constant Field Values
-
JMS_DESTINATION
Name of the Destination header. Specifies the destination of aMessage
or where it was received from.- See Also:
-
Message.getJMSDestination()
- Constant Field Values
-
JMS_EXPIRATION
Name of the Expiration header.- See Also:
-
Message.getJMSExpiration()
- Constant Field Values
-
JMS_MESSAGE_ID
Name of the ID header. Specifies a unique ID for aMessage
.- See Also:
-
Message.getJMSMessageID()
- Constant Field Values
-
JMS_PRIORITY
Name of the Priority header.- See Also:
-
Message.getJMSPriority()
- Constant Field Values
-
JMS_REDELIVERED
Name of the Redelivered header.- See Also:
-
Message.getJMSRedelivered()
- Constant Field Values
-
JMS_REPLY_TO
Name of the Reply To header.- See Also:
-
Message.getJMSReplyTo()
- Constant Field Values
-
JMS_TIMESTAMP
Name of the Timestamp header.- See Also:
-
Message.getJMSTimestamp()
- Constant Field Values
-
JMS_TYPE
Name of the Type header.- See Also:
-
Message.getJMSType()
- Constant Field Values
-
-
Method Details
-
isJMSHeader
- Parameters:
headerName
- the name of the header to test.- Returns:
- true if the given
headerName
is a supported JMS Header name
-
getHeader
@Nullable public static <T> T getHeader(String headerName, jakarta.jms.Message message, Class<T> clazz) Attempts to retrieve the value of the header given byheaderName
from the givenmessage
. Returns null if no value is present, or an exception occurs when extracting the header.- Type Parameters:
T
- the expected class of the header value.- Parameters:
headerName
- the name of the header to be extracted.message
- theMessage
to extract the header from.clazz
- the expected class of the header value.- Returns:
- the value of the header on the given
message
specified byheaderName
as an object of typeclazz
.
-