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

Claus Ibsen updated CAMEL-27286:
--------------------------------
    Fix Version/s: 4.24.0

> camel-consul - a route from a key/value or event consumer to a producer with 
> another key writes, deletes or fires the key it came from
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27286
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27286
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-consul
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>             Fix For: 4.24.0
>
>
> h3. What happens
> The {{consul:kv}} consumer sets the {{CamelConsulKey}} header to the key that 
> changed, and the {{consul:event}} consumer to the event name. Every 
> {{consul:kv}} action and the {{consul:event}} actions take the key from that 
> header before the {{key}} option of the endpoint. So a route from a watched 
> key to a producer with another key acts on the watched key:
> * {{from("consul:kv?key=config/a").to("consul:kv?key=config/b&action=PUT")}} 
> writes the value back to {{config/a}}, which starts the watch again (a PUT 
> changes the modify index even with the same value), so it loops for ever, and 
> {{config/b}} is never written.
> * with {{action=DELETE_KEY}} (or {{DELETE_KEYS}}, {{LOCK}}, {{UNLOCK}}) it 
> deletes or locks the watched key instead of the key of the endpoint.
> * {{from("consul:event?key=a").to("consul:event?key=b&action=FIRE")}} fires 
> event {{a}} again, an endless loop of events, and never fires {{b}}.
> h3. How to reproduce
> {{ConsulProducerReceivedKeyTest}} (camel-consul, mocked Consul clients as in 
> {{ConsulKeyValueWatchTest}}): PUT, DELETE_KEY and FIRE act on the received 
> key instead of the key of the endpoint.
> h3. Fix
> The key/value and event consumers also set the exchange property 
> {{CamelConsulReceivedKey}} to the key they received. A producer whose 
> endpoint has a {{key}} uses that key when the {{CamelConsulKey}} header still 
> holds the received key; a key header set by the route is still used, and a 
> producer without a {{key}} still acts on the received key (for example a 
> recursive watch that deletes each processed key). Same approach as the 
> received partition properties of camel-azure-eventhubs (CAMEL-25227).
> _Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to