Interface AzureMessageConverter<I,O>
- Type Parameters:
I
- The Azure message type when sending to the broker using Azure SDK.O
- The Azure message type when receiving from the broker using Azure SDK.
- All Known Implementing Classes:
AbstractAzureMessageConverter
public interface AzureMessageConverter<I,O>
A converter to turn the payload of a
Message
from serialized form to a typed
Object and vice versa.-
Method Summary
Modifier and TypeMethodDescriptionfromMessage
(org.springframework.messaging.Message<?> message, Class<O> targetClass) Convert the payload of aMessage
from a serialized form to a typed Object of the specified target class.default <U> org.springframework.messaging.Message<U>
Create an empty headerMessage
by default.<U> org.springframework.messaging.Message<U>
Create aMessage
whose payload is the result of converting the given payload Object to serialized form.
-
Method Details
-
fromMessage
Convert the payload of aMessage
from a serialized form to a typed Object of the specified target class.- Parameters:
message
- the input messagetargetClass
- the target class for the conversion- Returns:
- the result of the conversion, or
null
if the converter cannot perform the conversion
-
toMessage
@Nullable <U> org.springframework.messaging.Message<U> toMessage(I azureMessage, Map<String, Object> headers, Class<U> targetPayloadClass) Create aMessage
whose payload is the result of converting the given payload Object to serialized form. The optionalMessageHeaders
parameter may contain additional headers to be added to the message.- Type Parameters:
U
- payload class type in message- Parameters:
azureMessage
- the Object to convertheaders
- optional headers for the messagetargetPayloadClass
- the target payload class for the conversion- Returns:
- the new message, or
null
if the converter does not support the Object type or the target media type
-
toMessage
@Nullable default <U> org.springframework.messaging.Message<U> toMessage(I azureMessage, Class<U> targetPayloadClass) Create an empty headerMessage
by default.- Type Parameters:
U
- payload class type in message- Parameters:
azureMessage
- the Object to converttargetPayloadClass
- the target payload class for the conversion- Returns:
- the new message, or
null
if the converter does not support the * Object type or the target media type
-