Interface IMessageConverter
A converter to turn the payload of a message from serialized form to a typed object and vice versa.
Namespace: Steeltoe.Messaging.Converter
Assembly: Steeltoe.Messaging.Abstractions.dll
Syntax
public interface IMessageConverter
Methods
| Edit this page View SourceFromMessage(IMessage, Type)
Convert the payload of a message to a typed object.
Declaration
object FromMessage(IMessage message, Type targetClass)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | the input message |
Type | targetClass | the target type for the conversion |
Returns
Type | Description |
---|---|
System.Object | the result of the conversion |
FromMessage<T>(IMessage)
Convert the payload of a message to a typed object.
Declaration
T FromMessage<T>(IMessage message)
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | the input message |
Returns
Type | Description |
---|---|
T | the result of the conversion |
Type Parameters
Name | Description |
---|---|
T | the target type for the conversion |
ToMessage(Object, IMessageHeaders)
Create a message whose payload is the result of converting the given payload object to serialized form.
Declaration
IMessage ToMessage(object payload, IMessageHeaders headers)
Parameters
Type | Name | Description |
---|---|---|
System.Object | payload | the object to convert |
IMessageHeaders | headers | optional headers for the message |
Returns
Type | Description |
---|---|
IMessage | the new messagee or null if converter does not support the payload type |