Class JsonMessageSerializerBase
The base class for JsonMessageSerializer and JsonMessageSerializer<TMessage>.
Implements
Inherited Members
Namespace: Silverback.Messaging.Serialization
Assembly: Silverback.Integration.dll
Syntax
public abstract class JsonMessageSerializerBase : IMessageSerializer
Properties
| Improve this doc View sourceOptions
Gets or sets the options to be passed to the System.Text.Json.JsonSerializer.
Declaration
public JsonSerializerOptions Options { get; set; }
Property Value
Type | Description |
---|---|
System.Text.Json.JsonSerializerOptions |
RequireHeaders
Gets a value indicating whether headers are mandatory for this serializer implementation or configuration to work properly.
Declaration
public abstract bool RequireHeaders { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this doc View sourceDeserializeAsync(Stream, MessageHeaderCollection, MessageSerializationContext)
Deserializes the byte array back into a message object.
Declaration
public abstract ValueTask<(object Message, Type MessageType)> DeserializeAsync(Stream messageStream, MessageHeaderCollection messageHeaders, MessageSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | messageStream | The System.IO.Stream containing the message to be deserialized. |
MessageHeaderCollection | messageHeaders | The message headers collection. |
MessageSerializationContext | context | The context information. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.ValueTuple<System.Object, System.Type>> | A System.Threading.Tasks.Task<TResult> representing the asynchronous operation. The task result contains the
deserialized message (or |
SerializeAsync(Object, MessageHeaderCollection, MessageSerializationContext)
Serializes the specified message object into a byte array.
Declaration
public abstract ValueTask<Stream> SerializeAsync(object message, MessageHeaderCollection messageHeaders, MessageSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | message | The message object to be serialized. |
MessageHeaderCollection | messageHeaders | The message headers collection. |
MessageSerializationContext | context | The context information. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.IO.Stream> | A System.Threading.Tasks.Task<TResult> representing the asynchronous operation. The task result contains the System.IO.Stream with the serialized message. |