Skip to main content

Module resubscribe

Module resubscribe 

Source
Expand description

Functionality to detect NATS disconnects and seamless reconnects

Structs§

ConnectionSignals
Reconnect signals shared between the NATS event callback and the subscriber’s background task.

Enums§

ForwardOutcome
Outcome returned by forward_stream.

Constants§

RECONNECT_MAX_DELAY 🔒
Maximum backoff delay between re-subscription attempts (also the fallback delay when the backoff iterator is exhausted).

Functions§

await_connection 🔒
Waits until the connection is usable again.
forward_and_resubscribe 🔒
Body of the background task behind resubscribing_stream: forwards initial into tx, then alternates between re-subscribing and forwarding until the receiver is dropped.
forward_stream
Forwards items from stream into tx, watching signals.connected for disconnections.
resubscribe 🔒
Re-creates the message stream once the connection is back, retrying failed attempts with exponential backoff.
resubscribing_stream
Spawns the background re-subscribe/forward task for a durable consumer and returns the consumer-facing stream.

Type Aliases§

MessageStream
Boxed stream of the messages a subscription delivers; re-created on every re-subscribe.