Namespace Confluent.Kafka.SyncOverAsync
Classes
SyncOverAsyncDeserializerExtensionMethods
Extension methods related to SyncOverAsyncDeserializer.
SyncOverAsyncDeserializer<T>
An adapter that allows an async deserializer to be used where a sync deserializer is required. In using this adapter, there are two potential issues you should be aware of:
If you are working in a single threaded SynchronizationContext (for example, a WindowsForms application), you must ensure that all methods awaited by your deserializer (at all levels) are configured to NOT continue on the captured context, otherwise your application will deadlock. You do this by calling .ConfigureAwait(false) on every method awaited in your deserializer implementation. If your deserializer makes use of a library that does not do this, you can get around this by calling await Task.Run(() => ...) to force the library method to execute in a SynchronizationContext that is not single threaded. Note: all Confluent async deserializers comply with the above.
In any application, there is potential for a deadlock due to thread pool exhaustion. This can happen because in order for an async method to complete, a thread pool thread is typically required. However, if all available thread pool threads are in use waiting for the async methods to complete, there will be no threads available to complete the tasks (deadlock). Due to (a) the large default number of thread pool threads in the modern runtime and (b) the infrequent need for a typical async deserializer to wait on an async result (i.e. most deserializers will only infrequently need to execute asynchronously), this scenario should not commonly occur in practice.
SyncOverAsyncSerializerExtensionMethods
Extension methods related to SyncOverAsyncSerializer.
SyncOverAsyncSerializer<T>
An adapter that allows an async serializer to be used where a sync serializer is required. In using this adapter, there are two potential issues you should be aware of:
If you are working in a single threaded SynchronizationContext (for example, a WindowsForms application), you must ensure that all methods awaited by your serializer (at all levels) are configured to NOT continue on the captured context, otherwise your application will deadlock. You do this by calling .ConfigureAwait(false) on every method awaited in your serializer implementation. If your serializer makes use of a library that does not do this, you can get around this by calling await Task.Run(() => ...) to force the library method to execute in a SynchronizationContext that is not single threaded. Note: all Confluent async serializers are safe to use with this adapter.
In any application, there is potential for a deadlock due to thread pool exhaustion. This can happen because in order for an async method to complete, a thread pool thread is typically required. However, if all available thread pool threads are in use waiting for the async methods to complete, there will be no threads available to complete the tasks (deadlock). Due to (a) the large default number of thread pool threads in the modern runtime and (b) the infrequent need for a typical async serializer to wait on an async result (i.e. most serializers will only infrequently need to execute asynchronously), this scenario should not commonly occur in practice.