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

[Errno 107] Transport endpoint is not connected #28

Open
gborrageiro opened this issue Aug 15, 2023 · 0 comments
Open

[Errno 107] Transport endpoint is not connected #28

gborrageiro opened this issue Aug 15, 2023 · 0 comments

Comments

@gborrageiro
Copy link

Hello,

When trying to post messages to a nats server, I am getting regular errors of the form:

[Errno 107] Transport endpoint is not connected

I set up the connection as follows:

self.nats_client = NATSClient(
            url=self.nats_url, socket_timeout=60., socket_keepalive=True, verbose=True
        )
        self.nats_client.connect()

After I receive the error, I try setting up the connection again:

        try:
            self.nats_client.publish(
                subject=self.nats_subject,
                payload=json.dumps(
                    self.nats_msg, indent=2
                ).encode('utf-8')
            )
        except Exception as e:
            self.nats_client.close()
            self.nats_client.connect()

Am I expected to run self.nats_client.connect() each time before I try publish? There is a performance cost for doing so, which is why I have tried to avoid doing it regularly.

Thanks
Gabriel

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

1 participant