Class MessageUtils


  • public abstract class MessageUtils
    extends Object
    Author:
    Dave Syer, Oleg Zhurakousky
    • Field Detail

      • MESSAGE_TYPE

        public static String MESSAGE_TYPE
        Value for 'message-type' typically use as header key.
      • TARGET_PROTOCOL

        public static String TARGET_PROTOCOL
        Value for 'target-protocol' typically use as header key.
      • SOURCE_TYPE

        public static String SOURCE_TYPE
        Value for 'target-protocol' typically use as header key.
    • Constructor Detail

      • MessageUtils

        public MessageUtils()
    • Method Detail

      • create

        public static Object create​(Object handler,
                                    Object payload,
                                    Map<String,​Object> headers)
        <<<<<<< HEAD Create a message for the handler. If the handler is a wrapper for a function in an isolated class loader, then the message will be created with the target class loader (therefore the Message class must be on the classpath of the target class loader).
        Parameters:
        handler - the function that will be applied to the message
        payload - the payload of the message
        headers - the headers for the message
        Returns:
        a message with the correct class loader
      • unpack

        public static org.springframework.messaging.Message<?> unpack​(Object handler,
                                                                      Object message)
        Convert a message from the handler into one that is safe to consume in the caller's class loader. If the handler is a wrapper for a function in an isolated class loader, then the message will be created with the target class loader (therefore the Message class must be on the classpath of the target class loader).
        Parameters:
        handler - the function that generated the message
        message - the message to convert
        Returns:
        a message with the correct class loader
      • toCaseInsensitiveHeadersStructure

        public static MessageUtils.MessageStructureWithCaseInsensitiveHeaderKeys toCaseInsensitiveHeadersStructure​(org.springframework.messaging.Message<?> message)
        Returns (payload, headers) structure identical to `message` while substituting headers with case insensitive map.