shashank created CAMEL-26904:
--------------------------------

             Summary: camel-kafka - KafkaIdempotentRepository: a record without 
a value in its topic fails the start, or drops the rest of a poll
                 Key: CAMEL-26904
                 URL: https://issues.apache.org/jira/browse/CAMEL-26904
             Project: Camel
          Issue Type: Bug
          Components: camel-kafka
            Reporter: shashank
            Assignee: shashank


{{KafkaIdempotentRepository}} applies each record of its topic in 
{{addToCache}}, which takes the action from the record value with 
{{CacheAction.valueOf(value)}}. A record without a value (a tombstone, which an 
operator or a tool can write to the topic, for example to delete a key from a 
compacted topic; the repository never writes one) makes {{valueOf}} throw a 
{{NullPointerException}}, and only {{IllegalArgumentException}} is caught:
* at start, when the repository reads the topic from the beginning 
({{KafkaChangelog.populateCache}} has no catch), the repository fails to start 
for as long as the record is in the topic;
* in the background poll ({{KafkaChangelog.TopicPoller}}, which catches per 
poll), the records after it in that poll are not applied, and the consumer 
position is past them: the keys they add or remove are missing on this node.
A record with the action {{add}} or {{remove}} and no key fails the same way 
(the cache does not take a null key). The WARN for an unknown action logs the 
key, not the value.

This was listed as a residual in CAMEL-23996 (a null-valued record aborts the 
startup). {{KafkaKeyValueRepository}} skips a record without a value, but fails 
the same way for a put or delete without a key, or a value that cannot be 
deserialized (follow-up).

*Proposal*
Skip such a record with a WARN, and log the value in the WARN for an unknown 
action.

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to