Thanks for the discussion. Even though the `pause()` is called, when the processing logic is asynchronous, the `acknowledge()` will still not be called, resulting in re- consumed when the consumer is restarted.
The background here is that I found a problem similar to this issue <https://github.com/apache/pulsar/issues/8308> while testing. I agree with your points, there is also a bit of complexity found in the implementation process. So it's a good idea to leave the processing of this uncommon requirement to the user. Adding a new interface `beforeClose()` is a bit cleaner to implement. Any other suggestions? thx. -- Best Regards! crossoverJie PengHui Li <peng...@apache.org> 于2022年12月8日周四 10:17写道: > Hi, Jie > > One option is you can try to call consumer.pause() first. > Then the consumer will not increase flow permits. > No new messages will be dispatched to this consumer. > > And you can continue to receive messages from > the buffer of the consumer. After all cached messages > consumed. You can close the consumer. > > Thanks, > Penghui > > On Thu, Dec 8, 2022 at 3:02 AM 丛搏 <bog...@apache.org> wrote: > > > Hi, Jie: > > I think it's better to leave it to user handle. We try not to add APIs > that > > users can handle themselves. And I don't think there are many scenarios > > using this API, which brings about higher complexity. I tend to add a new > > interface beforeClose() in ConsumerInterceptor to allow users to > customiz. > > Thanks, > > bo > > > > Jie crossover <crossover...@gmail.com>于2022年12月7日 周三20:05写道: > > > > > Hi, pulsar community, > > > > > > I’ve opened a PIP to discuss: PIP-227: New API for closing the consumer > > > after waiting for the job to complete. > > > > > > The PIP link: https://github.com/apache/pulsar/issues/18799 > > > > > > Thanks. > > > -- > > > Best Regards! > > > crossoverJie > > > > > >