apache / pulsar-client-go

Apache Pulsar Go Client Library
https://pulsar.apache.org/
Apache License 2.0
660 stars 336 forks source link

Connection health checks #519

Open cameronbroe opened 3 years ago

cameronbroe commented 3 years ago

Is your feature request related to a problem? Please describe. As an application, I am unable to determine the current state of health of the Pulsar client. If my connection dies, my application ends up in a hanging state with infinite retries. Setting a maximum number of retries through the currently provided interface just causes a hanging state, with no notification that my application can respond to handle the error.

Describe the solution you'd like The Client should have an ErrorChannel that my application is able to consume messages from with information about where an error has happened, such as a connection being killed and retries failing. This will allow applications to detect when Pulsar is an unhealthy state and respond appropriately. The errors should identify whether it is a consumer or producer that failed as well, so applications can handle them different.

Describe alternatives you've considered For a Consumer specifically, I tried to patch so the ConsumerMessage channel is closed after a maximum number of retries have failed, but it seems there are still retries from the client end as well.

omnilight commented 3 years ago

496 is for consumer