Interface IAsyncStreamEventHandler
Async callback interface for receiving stream events. Handlers that implement this interface are awaited by SubscribeAsync(IStreamEventHandler, IEnumerable<string>?, IEnumerable<string>?, IEnumerable<string>?, CancellationToken), preventing slow handlers from causing gRPC stream backpressure.
public interface IAsyncStreamEventHandler : IStreamEventHandler
- Inherited Members
Methods
OnErrorAsync(Exception, CancellationToken)
Called when an error occurs in the event stream. Awaited by the stream loop.
Task OnErrorAsync(Exception ex, CancellationToken cancellationToken = default)
Parameters
exExceptionThe exception that occurred.
cancellationTokenCancellationTokenCancellation token for the stream.
Returns
OnEventAsync(TopicEventRequest, CancellationToken)
Called when a regular event is received. Awaited by the stream loop.
Task OnEventAsync(TopicEventRequest e, CancellationToken cancellationToken = default)
Parameters
eTopicEventRequestThe topic event request containing event data.
cancellationTokenCancellationTokenCancellation token for the stream.