Class MessageUtils
- java.lang.Object
-
- org.springframework.cloud.function.context.message.MessageUtils
-
public abstract class MessageUtils extends Object
- Author:
- Dave Syer, Oleg Zhurakousky
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessageUtils.MessageStructureWithCaseInsensitiveHeaderKeys
!!! INTERNAL USE ONLY, MAY CHANGE OR REMOVED WITHOUT NOTICE!!!
-
Field Summary
Fields Modifier and Type Field Description static String
MESSAGE_TYPE
Value for 'message-type' typically use as header key.static String
SOURCE_TYPE
Value for 'target-protocol' typically use as header key.static String
TARGET_PROTOCOL
Value for 'target-protocol' typically use as header key.
-
Constructor Summary
Constructors Constructor Description MessageUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
create(Object handler, Object payload, Map<String,Object> headers)
<<<<<<< HEAD Create a message for the handler.static MessageUtils.MessageStructureWithCaseInsensitiveHeaderKeys
toCaseInsensitiveHeadersStructure(org.springframework.messaging.Message<?> message)
Returns (payload, headers) structure identical to `message` while substituting headers with case insensitive map.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.
-
-
-
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.
-
-
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 theMessage
class must be on the classpath of the target class loader).- Parameters:
handler
- the function that will be applied to the messagepayload
- the payload of the messageheaders
- 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 theMessage
class must be on the classpath of the target class loader).- Parameters:
handler
- the function that generated the messagemessage
- 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.
-
-