Hi all, Recently I found a PR (https://github.com/apache/pulsar/pull/12195 <https://github.com/apache/pulsar/pull/12195>) that modifies the existing semantics of producer close. There're already some communications in this PR, but I think it's better to start a discussion here to let more know.
The existing implementation of producer close is: 1. Cancel all timers, including send and batch container (`batchMessageContainer`). 2. Complete all pending messages (`pendingMessages`) with `AlreadyCloseException`. See `ProducerImpl#closeAsync` for details. But the JavaDoc of `Producer#closeAsync` is: > No more writes will be accepted from this producer. Waits until all pending > write request are persisted. Anyway, the document and implementation are inconsistent. But specifically, we need to define the behavior for how to process `pendingMessages` and `batchMessageContainer` when producer call `closeAsync`. 1. batchMessageContainer: contains the buffered single messages (`Message<T>`). 2. pendingMessages: all inflight messages (`OpSendMsg`) in network. IMO, from the JavaDoc, only `pendingMessages` should be processed and the messages in `batchMessageContainer` should be discarded. Since other clients might have already implemented the similar semantics of Java clients. If we changed the semantics now, the behaviors among different clients might be inconsistent. Should we add a configuration to support graceful close to follow the docs? Or just change the current behavior? Thanks, Yunze