Interface IAsyncSerializer<T>
Asynchronous interface to convert POCO objects into serialized payload bytes. This interface supports modern .NET concurrency models and is designed for use with third-party serialization APIs that provide async operations.
public interface IAsyncSerializer<in T>
Type Parameters
TGeneric type argument for the input object on SerializeAsync(string, T, IDictionary<string, object>, CancellationToken)
- Extension Methods
Methods
Configure(IDictionary<string, object>)
Configures this IAsyncSerializer<T> with the specified properties.
void Configure(IDictionary<string, object> properties)
Parameters
propertiesIDictionary<string, object>The configuration properties
SerializeAsync(string, T, IDictionary<string, object>, CancellationToken)
Asynchronously serializes the given object into a byte array payload for the specified destination and optional headers.
Task<byte[]> SerializeAsync(string destinationName, T obj, IDictionary<string, object> headers = null, CancellationToken token = default)
Parameters
destinationNamestringThe topic or queue name to route the object.
objTBusiness object to serialize.
headersIDictionary<string, object>Defines additional headers that are not included in the returned bytes. This parameter can be used as an in/out parameter and may be modified during serialization. May be
null.tokenCancellationTokenThe cancellation token that can be used to cancel the asynchronous operation.