Table of Contents

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

messageBody string

The JSON-encoded string to unescape and convert.

Returns

byte[]

A UTF-8 encoded byte array of the unescaped string, or null if the deserialized value is null.

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

messageBody byte[]

The raw byte array representing the message body to be deserialized.

Returns

string

The deserialized JSON string if successful; otherwise, the raw UTF-8 decoded string. Returns null if the deserialized JSON value is null.