Interface ReassignmentHandler (1.4.12)

public interface ReassignmentHandler

A ReassignmentHandler is called any time a new partition assignment is received from the server. It will be called with both the previous and new assignments as decided by the backend.

The client library will not acknowledge the assignment until handleReassignment returns. The assigning backend will not assign any of the partitions in before to another server unless the assignment is acknowledged, or a client takes too long to acknowledged (currently 30 seconds from the time the assignment is sent from server's point of view).

Because of the above, as long as reassignment handling is processed quickly, it can be used to abort outstanding operations on partitions which are being assigned away from this client.

Methods

handleReassignment(Set<Partition> before, Set<Partition> after)

public abstract void handleReassignment(Set<Partition> before, Set<Partition> after)

Called with the previous and new assignment delivered to this client on an assignment change. The assignment will not be acknowledged until this method returns, so it should complete quickly, or the backend will assume it is non-responsive and assign all partitions away without waiting for acknowledgement.

handleReassignment will only be called after no new messages will be delivered for the partition.

Acks or nacks on messages from partitions being assigned away will have no effect.

Parameters
NameDescription
beforeSet<Partition>

the previous assignment

afterSet<Partition>

the new assignment