Why don't org.apache.pulsar.client.api.Producer and org.apache.pulsar.client.api.Consumer provide an isClose method? #20510
|
We want to report client metrics to Prometheus. |
Replies: 3 comments 4 replies
|
Thanks for your reporting! That sounds possible. What do you think @codelipenghui @eolivelli @BewareMyPower? If we have a lazy consensus here I can invest some time to try it out. |
Since the close state can only be changed by calling If you want to mark it as closed when the state is producer.closeAsync();
closed = true;If you want to mark it as closed only when the state is producer.closeAsync().whenComplete((_, e) -> {
if (e != null) {
closed.set(true); // closed is an AtomicInteger
}
});If you even want to treat the producer.closeAsync().whenComplete((_, e) -> {
closed.set(true); // closed is an AtomicInteger
});The current So The |
|
Today I tried to add wrapper to the producer. MessageId messageId = producer.newMessage().value("Hello Pulsar").send();I have to add another wrapper for TypedMessageBuilder, which is too troublesome. |
Make sense. After all in the reported case @maozhitao12450 has access to the producer. And you may wrap up your own producer extend: