KafkaPartitionedSource
The PartitionedSource over Kafka consumers: made by create from KafkaOptions, consumers without a group that commit nothing, since the runtime assigns the partitions and keeps the offsets.
partitions and offsets ask one consumer of their own (consumers makes it on the first call), one call at a time, since a Kafka consumer is not safe for concurrent use.
partitionOf is the producer's default partitioner: murmur2 of the key over the partition count.
read of a partition the source does not read yet joins the topic's shared consumer (SharedTopicConsumer): the tails of every partition of a topic this node owns go through one consumer, assigned those partitions by hand. A second read of a partition already joined, such as a subscription catching up, and a bounded read run a consumer of their own for as long as their flow is collected: assigned the one partition, it seeks to
fromand polls, each poll at most pollTimeout on a virtual thread, emitting what it got; the consumer closes when the flow ends or is cancelled, without waiting for a fetch still in flight.readAt runs one consumer of its own for the call, whatever the number of offsets: it seeks to each offset still wanted, in ascending order, and takes every wanted one a poll returns before it seeks again. Offsets the partition does not hold are left out before it seeks, so they are no gap. It closes the consumer without waiting for a fetch still in flight. On a broker that stops answering after the offsets, its polls come back empty and it ends only when its caller is cancelled, between two polls; the offsets requests themselves fail after the client's
default.api.timeout.ms. Its callers in the runtime have no bound of their own: a run's start (ParkedAtStart) and the retry scan read in the run's scope, which the run's stop cancels, and a reconcile stuck on the start fences the group afterwow.cluster.reconcile-timeoutand fails the node's liveness afterwow.health.liveness.stall-timeout.
Either way, an offset before the partition's earliest retained offset is a gap: the read never steps over it silently, but logs an error, counts it in offsetGaps and does what offsetGap says, by default failing with an OffsetGapException. A partition that ends before the read's offset, and a record at a lower leader epoch than the one before it, are another topic of the same name: whatever offsetGap says, the read ends, counted and logged the same way (OffsetGapPolicy), the shared tail and a read of its own alike (LeaderEpochs).
Each consumer is named after what it does (consumers takes the name, client.id with KafkaOptions): metadata for partitions and offsets, tail.<topic> for a topic's shared consumer and read.<topic>-<partition> for a read of its own, each with a number unique in the process, so an operator tells them apart in the client's logs and metrics, and the client registers each once.
close closes the shared consumers and the consumer of partitions and offsets, each before it returns: a metadata call in flight is woken out of its wait, so the consumer closes under its lock once the call ends. The other reads close their own. Every call after close is refused, and opens nothing.
Constructors
Properties
Functions
The topic's id, which the broker gives each creation of it: another once it is deleted and created again.
The partition the producer's default partitioner puts a message keyed key in: murmur2 of the key's UTF-8 bytes over the topic's partition count, as KafkaTopicProducer sends with no partition of its own.