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

There is no way to understand that client was disconnected from transport layer in microservice communication. #14044

Open
1 task done
tyler-durden-123 opened this issue Sep 27, 2024 · 0 comments
Labels
needs triage This issue has not been looked into type: enhancement 🐺

Comments

@tyler-durden-123
Copy link

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

I use Redis as a transport layer in microservice communication.

I need to know when nestjs_app/hybrid_app/microservice disconnected from transport layer.

I take into consideration two cases that lead to disconnection.

  1. Retry attempts are over.
  2. Error from transport layer(in my case Redis) during pod restart.

I need to understand that application is disconnected from transport layer and share this data using health check endpoint to restart pod.

The issue was also mentioned in this request #10029

Minimum reproduction code

https://github.com/endlesslydivided/app_sample

Steps to reproduce

1.start redis using docker compose up -d
For two apps
2.npm i
3.npm run start:dev
4.when you will have messages in hybrid app turn redis off
5.start redis again
6.now we don't have messages

Setup versions

[System Information]
OS Version : Windows 10.0.22631
NodeJS Version : v20.10.0
NPM Version : 10.8.2

[Nest CLI]
Nest CLI Version : 10.4.5

[Nest Platform Information]
platform-express version : 10.4.4
microservices version : 10.4.4
schematics version : 10.1.4
testing version : 10.4.4
common version : 10.4.4
core version : 10.4.4
cli version : 10.4.5

In which operating systems have you tested?

Windows

Describe the solution you'd like

Can we have .on() for ClientProxy to listen events(error, close).
Can we also have some additional field in connectMicroservice and createMicroservice to monitor events during communication with transport layer.

Teachability, documentation, adoption, migration strategy

client.on('closed', () => console.log('client disconnected'))

What is the motivation / use case for changing the behavior?

Motivation is to have ability to check that some of the client of microservice communication is disconnected, and use health check endpoint to restart pod.

@tyler-durden-123 tyler-durden-123 added needs triage This issue has not been looked into type: enhancement 🐺 labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into type: enhancement 🐺
Projects
None yet
Development

No branches or pull requests

1 participant