[ 
https://issues.apache.org/jira/browse/CAMEL-26194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-26194.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/29020 (merged to main as 
7ee0d02c48d4940bc3c2aec04fe4a42769671538).

_Claude Code on behalf of Claus Ibsen (davsclaus)_

> camel-zookeeper - a Map, POJO, Integer or null body overwrites the znode with 
> null data, and InOnly write failures are only logged
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26194
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26194
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-zookeeper
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Found while adding the catalog body types of zookeeper (CAMEL-24961, PR 
> #28414).
> h4. 1. A body that does not convert to byte[] overwrites the znode with null
> {{ZooKeeperUtils.getPayloadFromExchange}} (main 2a465aa4814c, line 90) uses 
> the non-mandatory {{ExchangeHelper.convertToType}}. For a Map, a POJO, an 
> Integer or a null body the payload is null and the producer silently sets the 
> znode data to null. Checked on 4.24.0-SNAPSHOT with ZooKeeper from test-infra 
> (docker).
> Proposed: use a mandatory conversion for a non-null body (keep null for an 
> explicit empty write if that is wanted).
> h4. 2. InOnly writes are fire-and-forget: failures are only logged
> For an InOnly exchange the producer writes asynchronously 
> ({{ZooKeeperProducer.process}} line 97 to 100) and the callbacks only log 
> errors ({{AsyncSetDataCallback}} line 171 to 190, for example a failed create 
> of a missing node), so the exchange succeeds even when the write failed. 
> Checked on 4.24.0-SNAPSHOT with ZooKeeper from test-infra.
> Proposed: write synchronously by default (or wait for the callback) and fail 
> the exchange on error.
> h4. 3. InOut DELETE with create=true creates a missing znode
> {{ZooKeeperProducer.synchronouslyDelete}} (line 239 to 247) calls 
> {{createNode}} when the node does not exist, with the body as data, so a 
> DELETE of a missing node with {{create=true}} creates it. Read in the code, 
> not run.
> Proposed: a DELETE of a missing node should do nothing (or report it), never 
> create it.
> h4. 4. Without repeat=true the consumer emits only the initial data
> The consumer registers a {{DataChangedOperation}} ({{ZooKeeperConsumer}} line 
> 235), but without {{repeat=true}} it does not go on after the first event 
> (line 177), so later data changes are not delivered. Checked on 
> 4.24.0-SNAPSHOT with ZooKeeper from test-infra.
> Proposed: document that repeat=true is needed to follow changes (or make the 
> watch follow changes by default).
> _Claude Code on behalf of davsclaus_



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

Reply via email to