Table of Contents

Property NotificationHandler

Namespace
NATS.Client.JetStream
Assembly
NATS.Client.JetStream.dll

NotificationHandler

A handler function invoked for notifications related to consumption, allowing custom handling of operational updates or state changes during the consumer's lifecycle.

public Func<INatsJSNotification, CancellationToken, Task>? NotificationHandler { get; init; }

Property Value

Func<INatsJSNotification, CancellationToken, Task>

Remarks

Possible notifications include:

NatsJSProtocolNotification is sent when the server sends a header not handled by the client.

NatsJSMessageSizeExceedsMaxBytesNotification is sent when a message exceeds the maximum bytes limit.

NatsJSLeadershipChangeNotification is sent when the JetStream leadership changes.

NatsJSNoRespondersNotification is sent when there are no responders for a request. This is a generic NATS server 503 error which may be caused by various reasons, however, in most cases it will indicate that the cluster's state is changing and a server is restarting.

NatsJSTimeoutNotification is sent when the client times out waiting for a response. It is triggered when the server does not respond within twice the idle heartbeat duration.