nats.rs
nats.rs copied to clipboard
expose retry_on_failed_connect option
- Expose retry_on_failed_connect option
- Debug error field
#[tokio::main]
async fn main() -> Result<(), async_nats::Error> {
async_nats::ConnectOptions::new()
.retry_on_failed_connect()
.connect("demo.nats.io")?;
Ok(())
}
It looks like retry_on_initial_connect
is already doing what you're looking for and retry_on_failed_connect
is just dead code
Oh, maybe this is the old code in syncing NATS. I can't reconnect in the consumer, but can I reconnect by switching to stream?
The reconnect happens automatically in the client.
You check the events
on connection to see what's the state of connection.
The retry_on_initial_connect
is for the client to retry connecting if initial connection failed.
Reconnecting afterwards will happen reagardless this option value.