Class StringMessageDeserializer<T>
Decodes the received string and wraps it into a StringMessage.
Inherited Members
Namespace: Silverback.Messaging.Serialization
Assembly: Silverback.Integration.dll
Syntax
public sealed class StringMessageDeserializer<T> : IMessageDeserializer, IEquatable<StringMessageDeserializer<T>> where T : StringMessage
Type Parameters
| Name | Description |
|---|---|
| T | The type discriminator. |
Constructors
StringMessageDeserializer(MessageEncoding?)
Initializes a new instance of the StringMessageDeserializer<T> class.
Declaration
public StringMessageDeserializer(MessageEncoding? encoding = null)
Parameters
| Type | Name | Description |
|---|---|---|
| MessageEncoding? | encoding | The message encoding. The default is UTF8. |
Properties
Encoding
Gets the message encoding. The default is UTF8.
Declaration
public MessageEncoding Encoding { get; }
Property Value
| Type | Description |
|---|---|
| MessageEncoding |
RequireHeaders
Gets a value indicating whether this serializer (with the current configuration) needs the headers support to work properly.
Declaration
public bool RequireHeaders { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
DeserializeAsync(Stream?, MessageHeaderCollection, ConsumerEndpoint)
Deserializes the byte array into a message object.
Declaration
public ValueTask<DeserializedMessage> DeserializeAsync(Stream? messageStream, MessageHeaderCollection headers, ConsumerEndpoint endpoint)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | messageStream | The Stream containing the message to be deserialized. |
| MessageHeaderCollection | headers | The message headers collection. |
| ConsumerEndpoint | endpoint | The endpoint. |
Returns
| Type | Description |
|---|---|
| ValueTask<DeserializedMessage> | A ValueTask<TResult> representing the asynchronous operation. The task result contains the
deserialized message (or |
Equals(StringMessageDeserializer<T>?)
Decodes the received string and wraps it into a StringMessage.
Declaration
public bool Equals(StringMessageDeserializer<T>? other)
Parameters
| Type | Name | Description |
|---|---|---|
| StringMessageDeserializer<T> | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object?)
Decodes the received string and wraps it into a StringMessage.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
GetCompatibleSerializer()
Gets a new IMessageSerializer compatible with this deserializer.
Declaration
public IMessageSerializer GetCompatibleSerializer()
Returns
| Type | Description |
|---|---|
| IMessageSerializer | A new instance of an IMessageSerializer compatible with this deserializer. |
GetHashCode()
Decodes the received string and wraps it into a StringMessage.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |