Reputation: 15
I want to know what happens to the current processing consumer thread when the rebalance occurs?
Consider three consumers threads are running and I have three partitions for a topic x.
max.poll.interval.ms= 500000
session.timeout.ms = 50000
heartbeat.interval.ms = 15000
max.poll.records = 1
consumer thread #t1 -> calls some service and waits till socket timeout which is infinite. That means the thread #t1 will not call poll again in worst case. Once it exceeds the 500000 time this rebalance is triggered
consumer thread #t2 and consumer thread #t3-> will participate in rebalance on the poll() method call as they were working fine.
Now, What happens to thread t1 at the time of rebalance?
Will that thread t1 be killed and will be considered at the time of reassignment of partition
OR will it keep on running continuously?
Because we see in our application onRebalance all the threads t1, t2 and t3 are getting partition assigned again. Then how and where in code does the thread get killed?
Using
Upvotes: 0
Views: 356
Reputation: 174504
The thread will not be killed (or interrupted, but socket reads are not interruptible anyway, you need to set a timeout).
When the thread finally returns (if it does), it will trigger another rebalance.
Upvotes: 2