nats.net icon indicating copy to clipboard operation
nats.net copied to clipboard

Cannot stop ConnectionFactory from creating a connection when reconnectOnConnect = true

Open ava-romo opened this issue 4 months ago • 1 comments

Proposed change

I would like to provide a cancellation token, or a method on the ConnectionFactory object that I can call to have it stop trying to create a connection. When reconnectOnConnect = true, then the ConnectionFactory.CreateConnection will block until it creates the connection, which is fine, but I don't have a way of stopping it. It'd be really great if it was async, too.

Use case

I want to be able to have the NATS client run before the server may be available. But then if the user wants to stop the client, and perhaps change config, then I want to be able to stop and re-start the ConnectionFactory.CreateConnection method

Contribution

No response

ava-romo avatar Feb 05 '24 22:02 ava-romo