You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by ashwin konale <as...@gmail.com> on 2018/11/23 15:00:36 UTC

Reading avro encoded message key from kafka

Hi,
I have key-value pair of avro messages in kafka topic I want to consume
from. I can easily do modifications on message value using nifi
consumeKafkaRecord processor, but it doesnt show key of the message.
ConsumeKafka processor has kafka.key attribute but I am not sure how to
read its contents(Since it is avro encoded) and add certain values as
attributes to flowfile. Any pointers will be much helpful.

Thanks

Re: Reading avro encoded message key from kafka

Posted by Mike Thomsen <mi...@gmail.com>.
Configure the producer to encode the key with that, not the message
contents.

On Fri, Nov 23, 2018 at 10:14 AM Mike Thomsen <mi...@gmail.com>
wrote:

> If you are having encoding-related issues with reading that attribute, try
> switching to the Kafka string serializer in your producer.
>
> On Fri, Nov 23, 2018 at 10:12 AM ashwin konale <as...@gmail.com>
> wrote:
>
>> Hi,
>> I have key-value pair of avro messages in kafka topic I want to consume
>> from. I can easily do modifications on message value using nifi
>> consumeKafkaRecord processor, but it doesnt show key of the message.
>> ConsumeKafka processor has kafka.key attribute but I am not sure how to
>> read its contents(Since it is avro encoded) and add certain values as
>> attributes to flowfile. Any pointers will be much helpful.
>>
>> Thanks
>>
>

Re: Reading avro encoded message key from kafka

Posted by Mike Thomsen <mi...@gmail.com>.
If you are having encoding-related issues with reading that attribute, try
switching to the Kafka string serializer in your producer.

On Fri, Nov 23, 2018 at 10:12 AM ashwin konale <as...@gmail.com>
wrote:

> Hi,
> I have key-value pair of avro messages in kafka topic I want to consume
> from. I can easily do modifications on message value using nifi
> consumeKafkaRecord processor, but it doesnt show key of the message.
> ConsumeKafka processor has kafka.key attribute but I am not sure how to
> read its contents(Since it is avro encoded) and add certain values as
> attributes to flowfile. Any pointers will be much helpful.
>
> Thanks
>