shashank created CAMEL-26910:
--------------------------------
Summary: camel-kafka - KafkaKeyValueRepository: a put or delete
without a key, or a put whose value cannot be read, fails the start or drops
the rest of a poll
Key: CAMEL-26910
URL: https://issues.apache.org/jira/browse/CAMEL-26910
Project: Camel
Issue Type: Bug
Components: camel-kafka
Reporter: shashank
Assignee: shashank
Sibling of CAMEL-26904 ({{KafkaIdempotentRepository}}, a record without a
value). {{KafkaKeyValueRepository}} applies each record of its topic in
{{addToCache}}. It skips a record without a value already, but:
* a put or delete record without a key makes the cache throw a
{{NullPointerException}} (the repository never writes one, as {{put}} and
{{delete}} use the cache first; another application or a tool can);
* a put whose value cannot be deserialized (a class that is not on the
classpath of this application, for example one stored by another version of it,
a class that the {{deserializationFilter}} does not allow, or bytes that are
not a serialized object) throws a {{RuntimeCamelException}}.
At start, {{KafkaChangelog}} reads the topic from the beginning without a
catch, so the repository fails to start for as long as the record is in the
topic. In the background poll, the catch is around the whole poll, so the
records after it in that poll are not applied, and the consumer position is
already past them.
Expected: such a record is logged at WARN and skipped, and the next records are
applied; for a put whose value cannot be read, the cache keeps what it has for
the key (the poller also reads back the puts of the repository itself, whose
value must stay). A clear (which has no key) is applied as before.
Found in the review of the {{KafkaIdempotentRepository}} fix; confirmed with
unit tests on the real class.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)