Class AmqpMessageSupport


  • public final class AmqpMessageSupport
    extends Object
    Support class containing constant values and static methods that are used to map to / from AMQP Message types being sent or received.
    • Constructor Detail

      • AmqpMessageSupport

        public AmqpMessageSupport()
    • Method Detail

      • getSymbol

        public static org.apache.qpid.proton.amqp.Symbol getSymbol​(String key)
        Lookup and return the correct Proton Symbol instance based on the given key.
        Parameters:
        key - the String value name of the Symbol to locate.
        Returns:
        the Symbol value that matches the given key.
      • getMessageAnnotation

        public static Object getMessageAnnotation​(String key,
                                                  org.apache.qpid.proton.message.Message message)
        Safe way to access message annotations which will check internal structure and either return the annotation if it exists or null if the annotation or any annotations are present.
        Parameters:
        key - the String key to use to lookup an annotation.
        message - the AMQP message object that is being examined.
        Returns:
        the given annotation value or null if not present in the message.
      • isContentType

        public static boolean isContentType​(String contentType,
                                            org.apache.qpid.proton.message.Message message)
        Check whether the content-type field of the properties section (if present) in the given message matches the provided string (where null matches if there is no content type present.
        Parameters:
        contentType - content type string to compare against, or null if none
        message - the AMQP message object that is being examined.
        Returns:
        true if content type matches
      • getCharsetForTextualContent

        public static Charset getCharsetForTextualContent​(String contentType)
        Parameters:
        contentType - the contentType of the received message
        Returns:
        the character set to use, or null if not to treat the message as text
      • getBinaryFromMessageBody

        public static org.apache.qpid.proton.amqp.Binary getBinaryFromMessageBody​(ActiveMQBytesMessage message)
                                                                           throws JMSException
        Return the encoded form of the BytesMessage as an AMQP Binary instance.
        Parameters:
        message - the Message whose binary encoded body is needed.
        Returns:
        a Binary instance containing the encoded message body.
        Throws:
        JMSException - if an error occurs while fetching the binary payload.
      • getBinaryFromMessageBody

        public static org.apache.qpid.proton.amqp.Binary getBinaryFromMessageBody​(ActiveMQObjectMessage message)
                                                                           throws JMSException
        Return the encoded form of the BytesMessage as an AMQP Binary instance.
        Parameters:
        message - the Message whose binary encoded body is needed.
        Returns:
        a Binary instance containing the encoded message body.
        Throws:
        JMSException - if an error occurs while fetching the binary payload.
      • getBinaryFromMessageBody

        public static org.apache.qpid.proton.amqp.Binary getBinaryFromMessageBody​(ActiveMQTextMessage message)
                                                                           throws JMSException
        Return the encoded form of the Message as an AMQP Binary instance.
        Parameters:
        message - the Message whose binary encoded body is needed.
        Returns:
        a Binary instance containing the encoded message body.
        Throws:
        JMSException - if an error occurs while fetching the binary payload.
      • getMapFromMessageBody

        public static Map<String,​Object> getMapFromMessageBody​(ActiveMQMapMessage message)
                                                              throws JMSException
        Return the underlying Map from the JMS MapMessage instance.
        Parameters:
        message - the MapMessage whose underlying Map is requested.
        Returns:
        the underlying Map used to store the value in the given MapMessage.
        Throws:
        JMSException - if an error occurs in constructing or fetching the Map.