Class RabbitIErrorMessageSerializer
- Namespace
- adas_core.Infrastructure.Utils
- Assembly
- adas-core.Infrastructure.dll
Provides an implementation of IErrorMessageSerializer tailored for use with RabbitMQ, responsible for serializing error messages into a format suitable for transport over RabbitMQ.
public class RabbitIErrorMessageSerializer : IErrorMessageSerializer
- Inheritance
-
RabbitIErrorMessageSerializer
- Implements
- Inherited Members
- Extension Methods
Remarks
This class serves as the RabbitMQ-specific concrete realization of the IErrorMessageSerializer contract.
Methods
Deserialize(string)
Deserializes a JSON-encoded string by unescaping its JSON representation and converts the result to a UTF-8 byte array.
Returns null when the deserialized string is null.
public byte[]? Deserialize(string messageBody)
Parameters
messageBodystringThe JSON-encoded string to unescape and convert.
Returns
- byte[]
A UTF-8 encoded byte array of the unescaped string, or
nullif the deserialized value isnull.
Serialize(byte[])
Attempts to deserialize the UTF-8 decoded message body as a JSON string, returning the original stringified content if deserialization fails.
public string? Serialize(byte[] messageBody)
Parameters
messageBodybyte[]The raw byte array representing the message body to be deserialized.