Class JMSHeaders

java.lang.Object
io.micronaut.jms.model.JMSHeaders

public final class JMSHeaders extends Object
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 Details

    • JMS_CORRELATION_ID

      public static final String JMS_CORRELATION_ID
      Name of the Correlation ID header. Specifies an ID so the Message can be linked to other messages.
      See Also:
    • JMS_DELIVERY_MODE

      public static final String JMS_DELIVERY_MODE
      Name of the Delivery Mode header.
      See Also:
    • JMS_DELIVERY_TIME

      public static final String JMS_DELIVERY_TIME
      Name of the Delivery Time header. Note: Only available when using a JMS 2.0 provider.
      See Also:
    • JMS_DESTINATION

      public static final String JMS_DESTINATION
      Name of the Destination header. Specifies the destination of a Message or where it was received from.
      See Also:
    • JMS_EXPIRATION

      public static final String JMS_EXPIRATION
      Name of the Expiration header.
      See Also:
    • JMS_MESSAGE_ID

      public static final String JMS_MESSAGE_ID
      Name of the ID header. Specifies a unique ID for a Message.
      See Also:
    • JMS_PRIORITY

      public static final String JMS_PRIORITY
      Name of the Priority header.
      See Also:
    • JMS_REDELIVERED

      public static final String JMS_REDELIVERED
      Name of the Redelivered header.
      See Also:
    • JMS_REPLY_TO

      public static final String JMS_REPLY_TO
      Name of the Reply To header.
      See Also:
    • JMS_TIMESTAMP

      public static final String JMS_TIMESTAMP
      Name of the Timestamp header.
      See Also:
    • JMS_TYPE

      public static final String JMS_TYPE
      Name of the Type header.
      See Also:
  • Method Details

    • isJMSHeader

      public static boolean isJMSHeader(String headerName)
      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, javax.jms.Message message, Class<T> clazz)
      Attempts to retrieve the value of the header given by headerName from the given message. 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 - the Message to extract the header from.
      clazz - the expected class of the header value.
      Returns:
      the value of the header on the given message specified by headerName as an object of type clazz.