Interface IAsyncDeserializer<T>
Asynchronous interface to convert serialized payload bytes into POCO objects. This interface supports modern .NET concurrency models and is designed for use with third-party deserialization APIs that provide async operations.
public interface IAsyncDeserializer<T>
Type Parameters
TGeneric type argument for the output object on DeserializeAsync(string, ReadOnlyMemory<byte>, IDictionary<string, object>, CancellationToken)
- Extension Methods
Methods
Configure(IDictionary<string, object>)
Configures this IAsyncDeserializer<T> with the specified properties.
void Configure(IDictionary<string, object> properties)
Parameters
propertiesIDictionary<string, object>The configuration properties
DeserializeAsync(string, ReadOnlyMemory<byte>, IDictionary<string, object>, CancellationToken)
Asynchronously deserializes payload bytes into a business object of type T. Optionally, headers can be provided to include additional metadata not in the payload bytes.
Task<T> DeserializeAsync(string destinationName, ReadOnlyMemory<byte> payload, IDictionary<string, object> headers = null, CancellationToken token = default)
Parameters
destinationNamestringThe topic or queue name to route the object.
payloadReadOnlyMemory<byte>The ReadOnlyMemory{byte} of payload from carrier to deserialize into an object of type T.
headersIDictionary<string, object>Defines additional headers that are not included in the payload bytes. This parameter can be used as an in/out parameter and may be modified during deserialization. May be
null.tokenCancellationTokenThe cancellation token that can be used to cancel the asynchronous operation.
Returns
- Task<T>
A task that represents the asynchronous operation. The task result contains the constructed object of type T from the payload bytes and headers (if provided).