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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Interface ReassignmentHandler (1.15.13)\n\nVersion latestkeyboard_arrow_down\n\n- [1.15.13 (latest)](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.15.12](/java/docs/reference/google-cloud-pubsublite/1.15.12/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.14.8](/java/docs/reference/google-cloud-pubsublite/1.14.8/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.13.8](/java/docs/reference/google-cloud-pubsublite/1.13.8/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.12.22](/java/docs/reference/google-cloud-pubsublite/1.12.22/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.11.2](/java/docs/reference/google-cloud-pubsublite/1.11.2/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.10.0](/java/docs/reference/google-cloud-pubsublite/1.10.0/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.9.4](/java/docs/reference/google-cloud-pubsublite/1.9.4/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.8.0](/java/docs/reference/google-cloud-pubsublite/1.8.0/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.7.1](/java/docs/reference/google-cloud-pubsublite/1.7.1/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.6.3](/java/docs/reference/google-cloud-pubsublite/1.6.3/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.5.5](/java/docs/reference/google-cloud-pubsublite/1.5.5/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler)\n- [1.4.12](/java/docs/reference/google-cloud-pubsublite/1.4.12/com.google.cloud.pubsublite.cloudpubsub.ReassignmentHandler) \n\n public interface ReassignmentHandler\n\nA ReassignmentHandler is called any time a new partition assignment is received from the server.\nIt will be called with both the previous and new assignments as decided by the backend.\n\nThe client library will not acknowledge the assignment until handleReassignment returns. The\nassigning backend will not assign any of the partitions in `before` to another server unless the\nassignment is acknowledged, or a client takes too long to acknowledged (currently 30 seconds from\nthe time the assignment is sent from server's point of view).\n\nBecause of the above, as long as reassignment handling is processed quickly, it can be used to\nabort outstanding operations on partitions which are being assigned away from this client.\n\nMethods\n-------\n\n### handleReassignment(Set\\\u003cPartition\\\u003e before, Set\\\u003cPartition\\\u003e after)\n\n public abstract void handleReassignment(Set\u003cPartition\u003e before, Set\u003cPartition\u003e after)\n\nCalled with the previous and new assignment delivered to this client on an assignment change.\nThe assignment will not be acknowledged until this method returns, so it should complete\nquickly, or the backend will assume it is non-responsive and assign all partitions away without\nwaiting for acknowledgement.\n\nhandleReassignment will only be called after no new messages will be delivered for the\npartition.\n\nAcks or nacks on messages from partitions being assigned away will have no effect."]]