Class KafkaStreamsAssignment
java.lang.Object
org.apache.kafka.streams.processor.assignment.KafkaStreamsAssignment
A simple container class for the assignor to return the desired placement of active and standby tasks on
KafkaStreams clients.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
static KafkaStreamsAssignment
of
(ProcessId processId, Set<KafkaStreamsAssignment.AssignedTask> assignment) Construct an instance of KafkaStreamsAssignment with this processId and the given set of assigned tasks.void
removeTask
(KafkaStreamsAssignment.AssignedTask removedTask) tasks()
toString()
withFollowupRebalance
(Instant rebalanceDeadline) This API can be used to request that a followup rebalance be triggered by the KafkaStreams client receiving this assignment.
-
Method Details
-
of
public static KafkaStreamsAssignment of(ProcessId processId, Set<KafkaStreamsAssignment.AssignedTask> assignment) Construct an instance of KafkaStreamsAssignment with this processId and the given set of assigned tasks. If you want this KafkaStreams client to request a followup rebalance, you can set the followupRebalanceDeadline via thewithFollowupRebalance(Instant)
API.- Parameters:
processId
- the processId for the KafkaStreams client that should receive this assignmentassignment
- the set of tasks to be assigned to this KafkaStreams client- Returns:
- a new KafkaStreamsAssignment object with the given processId and assignment
-
withFollowupRebalance
This API can be used to request that a followup rebalance be triggered by the KafkaStreams client receiving this assignment. The followup rebalance will be initiated after the provided deadline has passed, although it will always wait until it has finished the current rebalance before triggering a new one. This request will last until the new rebalance, and will be erased if a new rebalance begins before the scheduled followup rebalance deadline has elapsed. The next assignment must request the followup rebalance again if it still wants to schedule one for the given instant, otherwise no additional rebalance will be triggered after that.- Parameters:
rebalanceDeadline
- the instant after which this KafkaStreams client will trigger a followup rebalance- Returns:
- a new KafkaStreamsAssignment object with the same processId and assignment but with the given rebalanceDeadline
-
processId
- Returns:
- the
ProcessID
associated with thisKafkaStreamsAssignment
-
tasks
- Returns:
- a read-only set of assigned tasks that are part of this
KafkaStreamsAssignment
-
assignTask
-
removeTask
-
followupRebalanceDeadline
- Returns:
- the followup rebalance deadline in epoch time, after which this KafkaStreams client will trigger a new rebalance.
-
toString
-