Table of Contents

Class AsyncAsSyncDeserializerExtensionMethods

Namespace
Solace.Serdes
Assembly
Solace.Serdes.dll

Extension methods for adapting an IAsyncDeserializer<T> to work as a synchronous IDeserializer<T>.

public static class AsyncAsSyncDeserializerExtensionMethods
Inheritance
AsyncAsSyncDeserializerExtensionMethods
Inherited Members

Methods

AsSyncOverAsync<T>(IAsyncDeserializer<T>)

Adapts an IAsyncDeserializer<T> to work as a synchronous IDeserializer<T>. This allows async deserializer implementations to be used in synchronous contexts.

public static IDeserializer<T> AsSyncOverAsync<T>(this IAsyncDeserializer<T> deserializer)

Parameters

deserializer IAsyncDeserializer<T>

The async deserializer to adapt.

Returns

IDeserializer<T>

A synchronous IDeserializer<T> that wraps the async deserializer. The returned instance also implements IDisposable.

Type Parameters

T

The type of object to be deserialized.

Remarks

The returned instance implements IDisposable. When disposed, it will:

  • Cancel any in-flight deserialization operations
  • Dispose the wrapped async deserializer if it implements IDisposable

Important: Avoid disposing the wrapped async deserializer independently while the sync wrapper is still in use, as this may cause unexpected exceptions during deserialization.