maozhitao12450 opened a new issue, #20511:
URL: https://github.com/apache/pulsar/issues/20511

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Motivation
   
   We want to report client metrics to Prometheus.
   Currently, we save a reference to the consumer/producer when it is created, 
and then we retrieve the metrics from 
org.apache.pulsar.client.api.Producer#getStats when updating the metrics.
   However, in practice, some services use dynamically created and destroyed 
producers/consumers. Additionally, since the closing of producers and consumers 
is done during business operations, Pulsar does not provide any interceptors 
for closing them, and I cannot listen for their close events. Furthermore, 
pulsar do not provide an interface to check whether they are closed.
   
   
   ### Solution
   
   Could you provide an isClose interface?
   
   
   
   ### Alternatives
   
   It would be more appropriate to provide an interface that retrieves the 
current state of the producer/consumer, returning the 
org.apache.pulsar.client.impl.HandlerState.State of the current instance.
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to