Skip to content

KAFKA-20790: Promote streams assignor API to public module#22788

Open
gabriellefu wants to merge 4 commits into
apache:trunkfrom
gabriellefu:kip1357
Open

KAFKA-20790: Promote streams assignor API to public module#22788
gabriellefu wants to merge 4 commits into
apache:trunkfrom
gabriellefu:kip1357

Conversation

@gabriellefu

@gabriellefu gabriellefu commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Changes

New public API package

org.apache.kafka.coordinator.group.api.assignor.streams (in group-coordinator-api), all annotated with @InterfaceAudience.Public and @InterfaceStability.Evolving.

  • Moved TaskAssignor, GroupAssignment, GroupSpec, MemberAssignment, MemberSubscription, TaskId, TopologyDescriber, and TaskAssignorException from the internal streams.assignor package into the new public package.
  • Added package-info.java.
  • Reshaped the input/output contracts to match the KIP:
    • GroupSpec now exposes memberIds(), memberSubscription(id), memberAssignmentState(id), and configs() instead of members() and assignmentConfigs().
    • MemberSubscription is now a thin interface containing instanceId, rackId, processId, and clientTags.
    • Introduced MemberAssignmentState with activeTasks, standbyTasks, warmupTasks, taskOffsets, and taskEndOffsets to represent a member’s current assignment state, split out from the previous larger member spec.
    • MemberAssignment is now an interface exposing only activeTasks() and standbyTasks(). Warm-up tasks are no longer produced by the assignor and are now determined during reconciliation.

Internal implementations

These remain in group-coordinator, under the streams.assignor package.

  • Added MemberSubscriptionAndAssignmentImpl, which implements both MemberSubscription and MemberAssignmentState.
  • Added MemberAssignmentImpl, which implements MemberAssignment.
  • Removed the old AssignmentMemberSpec record.
  • Reworked GroupSpecImpl to back the new GroupSpec interface.
  • Updated the built-in assignors (StickyTaskAssignor, MockAssignor) and TargetAssignmentBuilder to use the new interfaces.
  • TargetAssignmentBuilder now always emits empty warm-up tasks in the resulting target assignment.
  • Updated import paths in GroupMetadataManager, TopologyMetadata, MemberTaskOffsets, and ProcessState.

Tests and benchmarks

  • Updated the streams assignor tests, TargetAssignmentBuilderTest, GroupMetadataManagerTest, and the JMH benchmarks (StreamsAssignorBenchmarkUtils, StreamsStickyAssignorBenchmark) to use the new API.
  • Rewrote GroupSpecImplTest to exercise the new accessors.
  • Restricted the output-asserting parameterized tests (testAssignmentHasNotChanged, testAssignmentSwapped, testPartialAssignmentUpdate) to ACTIVE and STANDBY, since warm-up tasks can no longer appear in assignor output.

@gabriellefu gabriellefu changed the title KAFKA-20683: Add broker side custom assignors for "streams" groups KAFKA-20790: Add broker side custom assignors for "streams" groups Jul 8, 2026
@gabriellefu gabriellefu changed the title KAFKA-20790: Add broker side custom assignors for "streams" groups KAFKA-20790: Promote streams assignor API to public module Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant