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

Add Client#reconnect #159

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add Client#reconnect #159

wants to merge 3 commits into from

Conversation

vankiru
Copy link
Collaborator

@vankiru vankiru commented Jan 17, 2025

Overview

This PR implements Client#reconnect method: Add reconnect method.

Notes for the reconnect method:

  • it does not reconnect twice if a client is alreadt reconnecting (due to an error or manual reconnect) and returns true.
  • it raises NATS::IO::ConnectionClosedError if a connection is closed, disconnected, or draining.

@vankiru vankiru marked this pull request as ready for review January 17, 2025 11:40
@@ -270,6 +270,19 @@ def connect(uri = nil, opts = {})
self
end

def reconnect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's call it force_reconnect like the Go client, there will likely be a more graceful reconnect in the future https://github.com/nats-io/nats.go/blob/4732ef6eefb7385904bbe0136bf0b93e82cc5270/nats.go#L2197-L2204

nats.close
end

it "resumes subscribtions work" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it "resumes subscribtions work" do
it "resumes subscriptions work" do

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.

2 participants