This message was deleted.
# general
s
This message was deleted.
e
hello
aren you closing it by calling “close” ? You could be aware of it. Usually you close it when the application is shutting down
z
Most operations should be closed manually, but looking at the code org.apache.pulsar.client.impl.ClientCnx#handleCloseProducer, the broker sometimes also closes the producer. Then I cannot know that it has been closed, so it is best to add a method to let the outside world know. Adding a close event listener may be more real-time and practical, but for my current usage, adding an isClose() method is enough.
Usually you close it when the application is shutting down ------------------- But now I just encountered that some of our services only create producer/consumer when they receive some special requests and then close them. So I have to know when it is closed, otherwise my monitoring will always hold the producer/consumer that has been closed. When the time is long enough, OOM will occur.
e
even if the broker sends a close producer command, the application should have the handle and react to failures when it tries to produce and eventually create a new producer
my monitoring will always hold the producer/consumer that has been closed
Now I understand your problem
maybe we could add a way to listen to that event
z
ok, i will create wrapper to my client consumer/producer to catch AlreadyClosedException , and wrap the close/closeAsync methods. about pulsar-client , can I submit a pull request to provide an event listener for producer state changes and add more methods to org.apache.pulsar.client.api.ConsumerEventListener?
e
yes you can, but probably you will need to submit a “PIP”, as it is a new API
z
👌
e
feel free to DM me if you need some help