Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose retry_on_failed_connect option #1237

Closed

Conversation

cn-kali-team
Copy link

  • 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(())
    }

@paolobarbolini
Copy link
Contributor

It looks like retry_on_initial_connect is already doing what you're looking for and retry_on_failed_connect is just dead code

@cn-kali-team
Copy link
Author

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?

@Jarema
Copy link
Member

Jarema commented Mar 22, 2024

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.

@Jarema
Copy link
Member

Jarema commented May 20, 2024

The dead code has been removed. Closing.
Sorry for the confusion.

@Jarema Jarema closed this May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants