Skip to content

StreamsPartitionAssignor

StreamsPartitionAssignor is a ConsumerPartitionAssignor (Apache Kafka) and a Configurable (Apache Kafka).

Supported Rebalance Protocols

List<RebalanceProtocol> supportedProtocols()

supportedProtocols returns the following RebalanceProtocols:

  1. RebalanceProtocol.EAGER
  2. RebalanceProtocol.COOPERATIVE (based on upgrade.from)

supportedProtocols is part of the ConsumerPartitionAssignor (Apache Kafka) abstraction.

Name

String name()

name is stream.

name is part of the ConsumerPartitionAssignor (Apache Kafka) abstraction.

configure

void configure(
  Map<String, ?> configs)

configure creates a new AssignorConfiguration (with the given configs).

configure...FIXME

configure is part of the Configurable (Apache Kafka) abstraction.

Consumer Group Assignment

GroupAssignment assign(
  Cluster metadata,
  GroupSubscription groupSubscription)

assign...FIXME

assign prints out the following DEBUG message to the logs:

Constructed client metadata [clientMetadata] from the member subscriptions.

assign prepareRepartitionTopics with the given cluster metadata (that gives a Map<TopicPartition, PartitionInfo> as allRepartitionTopicPartitions).

assign prints out the following DEBUG message to the logs:

Created repartition topics [allRepartitionTopicPartitions] from the parsed topology.

assign...FIXME

assign is part of the ConsumerPartitionAssignor (Apache Kafka) abstraction.

prepareRepartitionTopics

Map<TopicPartition, PartitionInfo> prepareRepartitionTopics(
  Cluster metadata)

prepareRepartitionTopics creates a new RepartitionTopics that is requested to setup and then for the topicPartitionsInfo.

assignTasksToClients

boolean assignTasksToClients(
  Cluster fullMetadata,
  Set<String> allSourceTopics,
  Map<Subtopology, TopicsInfo> topicGroups,
  Map<UUID, ClientMetadata> clientMetadataMap,
  Map<TaskId, Set<TopicPartition>> partitionsForTask,
  Set<TaskId> statefulTasks)

assignTasksToClients...FIXME

onAssignment

void onAssignment(
  Assignment assignment,
  ConsumerGroupMetadata metadata)

onAssignment...FIXME

onAssignment is part of the ConsumerPartitionAssignor (Apache Kafka) abstraction.

subscriptionUserData

ByteBuffer subscriptionUserData(
  Set<String> topics)

subscriptionUserData...FIXME

subscriptionUserData is part of the ConsumerPartitionAssignor (Apache Kafka) abstraction.

Logging

Enable ALL logging level for org.apache.kafka.streams.processor.internals.StreamsPartitionAssignor logger to see what happens inside.

Add the following line to log4j.properties:

log4j.logger.org.apache.kafka.streams.processor.internals.StreamsPartitionAssignor=ALL

Refer to Logging.

Back to top