You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Florian Hussonnois <fh...@gmail.com> on 2016/05/22 20:38:44 UTC
KafkaStreams / Processor API - How to retrieve offsets
Hi everyone,
Is there any way to retrieve the offset attached to each message with the
APIs of kafka streams ? Currently the Processor interface exposes only the
method process(K key, V value);
It would be usefull to get the offsets in order to implement DSL extensions
with some methods which need to identify each message.
Thanks in advance
--
Florian HUSSONNOIS
Re: KafkaStreams / Processor API - How to retrieve offsets
Posted by "Matthias J. Sax" <ma...@confluent.io>.
Hi,
you can use "ProcessorContext" that is provided via init(). The context
object is dynamically adjusted to the currently processed record
To get the offset, use "context.offset()".
-Matthias
On 05/22/2016 10:38 PM, Florian Hussonnois wrote:
> Hi everyone,
>
> Is there any way to retrieve the offset attached to each message with the
> APIs of kafka streams ? Currently the Processor interface exposes only the
> method process(K key, V value);
>
> It would be usefull to get the offsets in order to implement DSL extensions
> with some methods which need to identify each message.
>
> Thanks in advance
>