Federico Mariani created CAMEL-25879:
----------------------------------------
Summary: camel-infinispan - the key option of the producer takes
precedence over the CamelInfinispanKey header
Key: CAMEL-25879
URL: https://issues.apache.org/jira/browse/CAMEL-25879
Project: Camel
Issue Type: Improvement
Components: camel-infinispan
Reporter: Federico Mariani
Assignee: Federico Mariani
Fix For: 4.24.0
The {{infinispan}} and {{infinispan-embedded}} producers resolve the key of
every operation as {{message.getHeader(InfinispanConstants.KEY,
configuration::getKey)}}, so the {{CamelInfinispanKey}} header wins over the
{{key}} option configured on the endpoint.
An Infinispan consumer sets {{CamelInfinispanKey}} to the key of each cache
event. A route that sends those events to a producer configured with a fixed
key, such as
{code:java}
from("infinispan:source")
.removeHeader("CamelInfinispanCacheName")
.to("infinispan:target?operation=PUT&key=myKey&value=myValue");
{code}
writes to the key of the event instead of {{myKey}}. The {{key}} option set on
the endpoint should be the key the producer uses.
Change:
* the producer uses the {{key}} option when it is set, and the
{{CamelInfinispanKey}} header only when the endpoint does not set {{key}};
* the component docs explain the precedence of the key and cache name headers,
and that a route from an Infinispan consumer to an Infinispan producer should
remove the {{CamelInfinispan*}} headers to use the cache and key of the
producer endpoint ({{CamelInfinispanCacheName}} still takes precedence over the
cache name of the endpoint);
* upgrade guide 4.24 note for routes that set {{key}} on the endpoint and
override it per message with the header.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)