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
Proposed update to enable reconnect on first attempt #223
Conversation
We have some other client implementations that allow this on an opt-in behavior IIRC. We should make this consistent with them IMO. |
We do have it in Go, C, Node, etc.. indeed. In Go, the option is called "RetryOnFailedConnect". |
OK thanks. Will review and follow up with an update. |
Hi, |
Thanks, will take a look early next week! |
Just showing some additional interest for this to land |
@pozsgaic Requested some minor changes in the PR. Thanks for your patience. |
Thanks for reviewing the changes. I will address in the next few days. |
We tested this PR as we desperately want this feature to reduce dependency on startup order of components in our system. Sadly, we observed that the |
@MattesWhite Thanks for your feedback and testing. Much appreciated! Changes can be adapted to what you said, so they work in similar fashion to Go reference client:
To monitor state of the client, you can utilise optional callbacks ( Additional feedback is of course welcomed. |
@pozsgaic To not duplicate work: I have working code for requirements described in my last comment. Will add them after cleanup and testing. EDIT: Thanks for applying review notes! |
@MattesWhite To streamline the process we will merge this PR and follow it up with one having behaviour you described, as it needs some testing around informative errors coming from publish/subscribe and Jetstream if the server did not yet connect and user code started using those. Until that happens (is on my list now so should be there really soon) you can wrap the connection into separate thread to achieve what you need if it's blocking your development. @pozsgaic LGTM after pipeline is green. After pipeline is green, please squash the commits. |
@pozsgaic Please squash the commits and we can merge :). |
Signed-off-by: pozsgaic <chris.pozsgai@progress.com>
Sorry for the delay. Updated as requested. Thanks again! |
That you for your contribution! Merged. |
We have had issues connecting on the first attempt, similar to issue brought up in the past:
#99
We modified the nats.rs to enable us to enter the retry loop on the first connection attempt. Our application behavior is such that we do not require the NatsServer be up and running when we start. This change allows for that behavior.