Expand description
Functionality to detect NATS disconnects and seamless reconnects
Structs§
- Connection
Signals - Reconnect signals shared between the NATS event callback and the subscriber’s background task.
Enums§
- Forward
Outcome - 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: forwardsinitialintotx, then alternates between re-subscribing and forwarding until the receiver is dropped. - forward_
stream - Forwards items from
streamintotx, watchingsignals.connectedfor 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§
- Message
Stream - Boxed stream of the messages a subscription delivers; re-created on every re-subscribe.