You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Arnaud BOS <ar...@gmail.com> on 2017/10/18 09:36:44 UTC

Storm-kafka-client RecordTranslator error handling

Hi all,

I've implemented a simple RecordTranslator in order to decode an
Avro message sent by a Kafka producer.

The interesting bit looks like the standard decoding example:

SpecificDatumReader<User> reader = new
SpecificDatumReader<User>(User.getClassSchema());
Decoder decoder = DecoderFactory.get().binaryDecoder(bytes, null);
User user = reader.read(null, decoder);

However `reader.read` throws an `IOException` in case of a decoding error.

How am I supposed to deal with the error ?

Logging a warning message and return `null` ?
What would be the implications downstream ?

Thanks for your help.

Re: Storm-kafka-client RecordTranslator error handling

Posted by Arnaud BOS <ar...@gmail.com>.
I've set emitNullTuples to false and I log an error, as you said: I control
the Avro producer so decoding errors shouldn't happen.

Thanks.

Le sam. 21 oct. 2017 à 11:34, Stig Rohde Døssing <sr...@apache.org> a écrit :

> You can return null and use the null filtering feature to drop the tuple
> https://github.com/apache/storm/pull/1999/files#diff-d659c1bc030b3a9d2af43523215ccceeR412
> (1.1.0 or later).
>
> If you control the Avro producer so decoding errors shouldn't happen, I'd
> log it as an error log because it indicates a bug in your code.
>
> 2017-10-18 11:36 GMT+02:00 Arnaud BOS <ar...@gmail.com>:
>
>> Hi all,
>>
>> I've implemented a simple RecordTranslator in order to decode an
>> Avro message sent by a Kafka producer.
>>
>> The interesting bit looks like the standard decoding example:
>>
>> SpecificDatumReader<User> reader = new SpecificDatumReader<User>(User.getClassSchema());
>> Decoder decoder = DecoderFactory.get().binaryDecoder(bytes, null);
>> User user = reader.read(null, decoder);
>>
>> However `reader.read` throws an `IOException` in case of a decoding error.
>>
>> How am I supposed to deal with the error ?
>>
>> Logging a warning message and return `null` ?
>> What would be the implications downstream ?
>>
>> Thanks for your help.
>>
>
>

Re: Storm-kafka-client RecordTranslator error handling

Posted by Stig Rohde Døssing <sr...@apache.org>.
You can return null and use the null filtering feature to drop the tuple
https://github.com/apache/storm/pull/1999/files#diff-d659c1bc030b3a9d2af43523215ccceeR412
(1.1.0 or later).

If you control the Avro producer so decoding errors shouldn't happen, I'd
log it as an error log because it indicates a bug in your code.

2017-10-18 11:36 GMT+02:00 Arnaud BOS <ar...@gmail.com>:

> Hi all,
>
> I've implemented a simple RecordTranslator in order to decode an
> Avro message sent by a Kafka producer.
>
> The interesting bit looks like the standard decoding example:
>
> SpecificDatumReader<User> reader = new SpecificDatumReader<User>(User.getClassSchema());
> Decoder decoder = DecoderFactory.get().binaryDecoder(bytes, null);
> User user = reader.read(null, decoder);
>
> However `reader.read` throws an `IOException` in case of a decoding error.
>
> How am I supposed to deal with the error ?
>
> Logging a warning message and return `null` ?
> What would be the implications downstream ?
>
> Thanks for your help.
>