Skip to content


KafkaSourceOffset is an Offset for kafka data source.

KafkaSourceOffset is <> (directly or indirectly using <>) when:

[[creating-instance]][[partitionToOffsets]] KafkaSourceOffset takes a collection of Kafka TopicPartitions with offsets to be created.

=== [[getPartitionOffsets]] Partition Offsets -- getPartitionOffsets Method

[source, scala]

getPartitionOffsets( offset: Offset): Map[TopicPartition, Long]

getPartitionOffsets takes <> from offset.

If offset is KafkaSourceOffset, getPartitionOffsets takes the partitions and offsets straight from it.

If however offset is SerializedOffset, getPartitionOffsets deserializes the offsets from JSON.

getPartitionOffsets reports an IllegalArgumentException when offset is neither KafkaSourceOffset or SerializedOffset.

Invalid conversion from offset of [class] to KafkaSourceOffset

getPartitionOffsets is used when:

=== [[json]] JSON-Encoded Offset -- json Method

[source, scala]

json: String

json is part of the Offset abstraction.


=== [[apply]] Creating KafkaSourceOffset Instance -- apply Utility Method

[source, scala]

apply( offsetTuples: (String, Int, Long)*): KafkaSourceOffset // <1> apply( offset: SerializedOffset): KafkaSourceOffset

<1> Used in tests only


apply is used when: