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

Have to close IConnection manually when closing ISTANConnection #79

Closed
selstam opened this issue Oct 8, 2018 · 3 comments
Closed

Have to close IConnection manually when closing ISTANConnection #79

selstam opened this issue Oct 8, 2018 · 3 comments

Comments

@selstam
Copy link

selstam commented Oct 8, 2018

I saw some rogue connection on my NATS-server and they kept increasing in numbers.

I noticed that simply closing the ISTANConnection wouldn't unsubscribe the internal IConnection. I have to manually close the IConnection before closing the ISTANConnection to release the connection to my server.

_stanConnection.NATSConnection.Close();
_stanConnection.Close();

Even if i try to dispose the ISTANConnection the connection to the NATS server remains.

@ColinSullivan1
Copy link
Member

Did you create a NATS connection yourself and pass it in through StanOptions.NatsConn, or let the STAN API create it?

@selstam
Copy link
Author

selstam commented Nov 6, 2018

Did you create a NATS connection yourself and pass it in through StanOptions.NatsConn, or let the STAN API create it?

I created the NATS connection myself and passed it on to StanConnectionFactory().CreateConnection() ...

@ColinSullivan1
Copy link
Member

@selstam , In that case, you'll need to close the connection you passed into the NATS streaming client. The NATS streaming client won't close (or otherwise alter) a NATS connection passed to it.

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

No branches or pull requests

2 participants