Search code examples
apache-kafkaapache-kafka-streams

How to get Offset , partition and timeStamp values of ConsumedRecord in KafkaStreams (KStreams)?


I'm consuming avro message using genericRecord .

final KStream<String, org.apache.avro.generic.GenericRecord> kStream = streamsBuilder
                .stream(topicName, Consumed.with(Serdes.String(),genericAvroSerde));

I need to get the offset value , partition value and timeStamp of consumed record . So , could anyone please guide me on how to get those values .

Thanx for the help in advance


Solution

  • It's not possible to get these values using Kafka Steams DSL.

    The Processor API, however, can

    https://kafka.apache.org/32/javadoc/org/apache/kafka/streams/processor/ProcessorContext.html