Hi Boyuan,
You can create a *ConsumerRebalanceListener* and do something you want when
*onPartitionsRevoked. *
Please check this java doc for more information:
https://kafka.apache.org/27/javadoc/org/apache/kafka/clients/consumer/ConsumerRebalanceListener.html

Thanks.
Luke

On Thu, Jan 7, 2021 at 8:45 AM Boyuan Zhang <boyu...@apache.org> wrote:

> Hi team,
>
> I'm working on a long run application, which uses the Kafka Consumer API to
> poll messages from a given topic and partition. I'm assigning the topic and
> partition manually by using consumer.assign() API and polling messages by
> using consumer.poll().
>
> One common scenario for my application is that certain partitions could be
> removed outside of my application and my application needs to know one
> partition has been removed to stop processing that partition. My question
> is that is there any way to get the removal information when I do
> consumer.assign() or consumer.poll() or any APIs that I can use?
>
> Thanks for your help!
>

Reply via email to