From f1992ae2bfffda3bf07c63e9113e2bb76877f84c Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 20 Oct 2026 11:43:50 +0200 Subject: [PATCH 1/4] CAMEL-25879: camel-infinispan - the key option of the producer takes precedence over the key header The producer resolved the key of every operation from the CamelInfinispanKey header first and fell back to the key option of the endpoint, so the events of an Infinispan consumer, which set CamelInfinispanKey to the key of the event, overrode a key configured on the producer endpoint. The producer now uses the key option when it is set, and the header only when the endpoint does not set key. The component docs describe the precedence of the key and cache name headers and how to forward consumer events to a producer, and the 4.24 upgrade guide lists the change. --- .../catalog/docs/infinispan-component.adoc | 19 +++++++++++ .../docs/infinispan-embedded-component.adoc | 19 +++++++++++ .../infinispan/InfinispanProducer.java | 32 +++++++++++-------- .../InfinispanProducerTestSupport.java | 6 ++-- .../docs/infinispan-embedded-component.adoc | 19 +++++++++++ .../src/main/docs/infinispan-component.adoc | 19 +++++++++++ .../pages/camel-4x-upgrade-guide-4_24.adoc | 10 ++++++ 7 files changed, 109 insertions(+), 15 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc index a6a5b9645c520..5375ad99dfb0d 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc @@ -200,6 +200,25 @@ The resulting value is returned in the exchange *body*. Write methods like put(key, value) and remove(key) do not return the previous value by default. ==== +=== Key and cache name headers + +The `key` option of the endpoint takes precedence over the `CamelInfinispanKey` header. When the endpoint does not set +`key`, the producer uses the `CamelInfinispanKey` header. + +The `CamelInfinispanCacheName` header takes precedence over the cache name of the endpoint. + +A `infinispan` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. +When a route sends those events to a `infinispan` producer, the producer works on the cache of the event, and on the key +of the event unless the endpoint sets `key`. To use the cache and the key configured on the producer endpoint, remove +the headers first: + +[source,java] +---- +from("infinispan:source") + .removeHeaders("CamelInfinispan*") + .to("infinispan:target?operation=PUT&key=myKey"); +---- + == Examples * Put a key/value into a named cache: diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc index 6be7f5019d0f8..2a16bb5046115 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc @@ -214,6 +214,25 @@ This section lists all available operations, along with their header information Write methods like put(key, value) and remove(key) do not return the previous value by default. ==== +=== Key and cache name headers + +The `key` option of the endpoint takes precedence over the `CamelInfinispanKey` header. When the endpoint does not set +`key`, the producer uses the `CamelInfinispanKey` header. + +The `CamelInfinispanCacheName` header takes precedence over the cache name of the endpoint. + +A `infinispan-embedded` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. +When a route sends those events to a `infinispan-embedded` producer, the producer works on the cache of the event, and on the key +of the event unless the endpoint sets `key`. To use the cache and the key configured on the producer endpoint, remove +the headers first: + +[source,java] +---- +from("infinispan-embedded:source") + .removeHeaders("CamelInfinispan*") + .to("infinispan-embedded:target?operation=PUT&key=myKey"); +---- + == Examples * Put a key/value into a named cache: diff --git a/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java b/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java index 196e174d2c331..552cd44c640a4 100644 --- a/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java +++ b/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java @@ -68,7 +68,7 @@ protected M getManager() { @InvokeOnHeader("PUT") public void onPut(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object value = message.getHeader(InfinispanConstants.VALUE, configuration::getValue); final Object result; @@ -94,7 +94,7 @@ public void onPut(Message message) { @InvokeOnHeader("PUTASYNC") public void onPutAsync(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object value = message.getHeader(InfinispanConstants.VALUE, configuration::getValue); final CompletableFuture result; @@ -167,7 +167,7 @@ public void onPutAllAsync(Message message) { @InvokeOnHeader("PUTIFABSENT") public void onPutIfAbsent(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object value = message.getHeader(InfinispanConstants.VALUE, configuration::getValue); final Object result; @@ -193,7 +193,7 @@ public void onPutIfAbsent(Message message) { @InvokeOnHeader("PUTIFABSENTASYNC") public void onPutIfAbsentAsync(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object value = message.getHeader(InfinispanConstants.VALUE, configuration::getValue); final CompletableFuture result; @@ -219,7 +219,7 @@ public void onPutIfAbsentAsync(Message message) { @InvokeOnHeader("GET") public void onGet(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object result = cache.get(key); setResult(message, result); @@ -228,7 +228,7 @@ public void onGet(Message message) { @InvokeOnHeader("GETORDEFAULT") public void onGetOrDefault(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object defaultValue = message.getHeader(InfinispanConstants.DEFAULT_VALUE, configuration::getDefaultValue); final Object result = cache.getOrDefault(key, defaultValue); @@ -238,7 +238,7 @@ public void onGetOrDefault(Message message) { @InvokeOnHeader("CONTAINSKEY") public void onContainsKey(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object result = cache.containsKey(key); setResult(message, result); @@ -256,7 +256,7 @@ public void onContainsValue(Message message) { @InvokeOnHeader("REMOVE") public void onRemove(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object value = message.getHeader(InfinispanConstants.VALUE, configuration::getValue); final Object result; @@ -272,7 +272,7 @@ public void onRemove(Message message) { @InvokeOnHeader("REMOVEASYNC") public void onRemoveAsync(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object value = message.getHeader(InfinispanConstants.VALUE, configuration::getValue); final CompletableFuture resultRemoveAsyncKey; final CompletableFuture resultRemoveAsyncKeyValue; @@ -289,7 +289,7 @@ public void onRemoveAsync(Message message) { @InvokeOnHeader("REPLACE") public void onReplace(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object value = message.getHeader(InfinispanConstants.VALUE, configuration::getValue); final Object oldValue = message.getHeader(InfinispanConstants.OLD_VALUE, configuration::getOldValue); final Object result; @@ -328,7 +328,7 @@ public void onReplace(Message message) { @InvokeOnHeader("REPLACEASYNC") public void onReplaceAsync(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object value = message.getHeader(InfinispanConstants.VALUE, configuration::getValue); final Object oldValue = message.getHeader(InfinispanConstants.OLD_VALUE, configuration::getOldValue); final CompletableFuture resultWithNewValue; @@ -396,7 +396,7 @@ public void onCLearAsync(Message message) { @InvokeOnHeader("COMPUTE") public void onCompute(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final Object result = cache.compute(key, configuration.getRemappingFunction()); setResult(message, result); @@ -406,7 +406,7 @@ public void onCompute(Message message) { @InvokeOnHeader("COMPUTEASYNC") public void onComputeAsync(Message message) { final BasicCache cache = getCache(message); - final Object key = message.getHeader(InfinispanConstants.KEY, configuration::getKey); + final Object key = getKey(message); final CompletableFuture result = cache.computeAsync(key, configuration.getRemappingFunction()); setResult(message, result); @@ -420,6 +420,12 @@ protected BasicCache getCache(Message message) { return manager.getCache(message, this.cacheName); } + protected Object getKey(Message message) { + // the key configured on the endpoint wins over the header + Object key = configuration.getKey(); + return key != null ? key : message.getHeader(InfinispanConstants.KEY); + } + protected boolean hasLifespan(Message message) { return hasExpiry(message, InfinispanConstants.LIFESPAN_TIME, InfinispanConstants.LIFESPAN_TIME_UNIT, lifespanReported); diff --git a/components/camel-infinispan/camel-infinispan-common/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTestSupport.java b/components/camel-infinispan/camel-infinispan-common/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTestSupport.java index 1f93ee29468ed..8575d93999519 100644 --- a/components/camel-infinispan/camel-infinispan-common/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTestSupport.java +++ b/components/camel-infinispan/camel-infinispan-common/src/test/java/org/apache/camel/component/infinispan/InfinispanProducerTestSupport.java @@ -859,7 +859,7 @@ default void publishKeyAndValueByExplicitlySpecifyingTheKeyAndValueOptions() { } @Test - default void publishKeyAndValueByExplicitlySpecifyingTheKeyAndValueOptionsHeaderHavePriorities() { + default void publishKeyAndValueByExplicitlySpecifyingTheKeyAndValueOptionsKeyOptionHasPriority() { fluentTemplate() .to("direct:explicitput") .withHeader(InfinispanConstants.KEY, KEY_ONE) @@ -867,6 +867,8 @@ default void publishKeyAndValueByExplicitlySpecifyingTheKeyAndValueOptionsHeader .withHeader(InfinispanConstants.OPERATION, InfinispanOperation.PUT) .send(); - assertEquals(VALUE_ONE, getCache().get(KEY_ONE)); + // the key option of the endpoint wins over the key header, the value header still wins over the value option + assertEquals(VALUE_ONE, getCache().get("a")); + assertNull(getCache().get(KEY_ONE)); } } diff --git a/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc b/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc index 6be7f5019d0f8..2a16bb5046115 100644 --- a/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc +++ b/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc @@ -214,6 +214,25 @@ This section lists all available operations, along with their header information Write methods like put(key, value) and remove(key) do not return the previous value by default. ==== +=== Key and cache name headers + +The `key` option of the endpoint takes precedence over the `CamelInfinispanKey` header. When the endpoint does not set +`key`, the producer uses the `CamelInfinispanKey` header. + +The `CamelInfinispanCacheName` header takes precedence over the cache name of the endpoint. + +A `infinispan-embedded` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. +When a route sends those events to a `infinispan-embedded` producer, the producer works on the cache of the event, and on the key +of the event unless the endpoint sets `key`. To use the cache and the key configured on the producer endpoint, remove +the headers first: + +[source,java] +---- +from("infinispan-embedded:source") + .removeHeaders("CamelInfinispan*") + .to("infinispan-embedded:target?operation=PUT&key=myKey"); +---- + == Examples * Put a key/value into a named cache: diff --git a/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc b/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc index a6a5b9645c520..5375ad99dfb0d 100644 --- a/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc +++ b/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc @@ -200,6 +200,25 @@ The resulting value is returned in the exchange *body*. Write methods like put(key, value) and remove(key) do not return the previous value by default. ==== +=== Key and cache name headers + +The `key` option of the endpoint takes precedence over the `CamelInfinispanKey` header. When the endpoint does not set +`key`, the producer uses the `CamelInfinispanKey` header. + +The `CamelInfinispanCacheName` header takes precedence over the cache name of the endpoint. + +A `infinispan` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. +When a route sends those events to a `infinispan` producer, the producer works on the cache of the event, and on the key +of the event unless the endpoint sets `key`. To use the cache and the key configured on the producer endpoint, remove +the headers first: + +[source,java] +---- +from("infinispan:source") + .removeHeaders("CamelInfinispan*") + .to("infinispan:target?operation=PUT&key=myKey"); +---- + == Examples * Put a key/value into a named cache: diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc index 273f5d2b8a8e8..947339c007de5 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc @@ -2316,3 +2316,13 @@ a keep-alive message that does not wait for a reply, so it does not find such a noop is a request that waits for the reply, so with `sendNoop=false` such a connection is found by the next poll, which fails and is logged before the consumer connects again. For sftp and mina-sftp, set `serverAliveInterval` to let the client close such a connection itself, so that the consumer connects again before the poll. + +=== camel-infinispan - the key option of the producer takes precedence over the key header + +The `infinispan` and `infinispan-embedded` producers now use the `key` option of the endpoint when it is set, and use the +`CamelInfinispanKey` header only when the endpoint does not set `key`. Previously the header took precedence over the +option, so a route that sent the events of an Infinispan consumer, which set `CamelInfinispanKey` to the key of the event, +to a producer with a fixed `key` worked on the key of the event. + +Routes that set `key` on the endpoint and override it per message with the `CamelInfinispanKey` header must remove `key` +from the endpoint. From ecc04835d065237e0dc1111127de62ef865c9842 Mon Sep 17 00:00:00 2001 From: croway Date: Tue, 20 Oct 2026 12:56:27 +0200 Subject: [PATCH 2/4] CAMEL-25879: camel-infinispan - use "an" before infinispan in the docs --- .../org/apache/camel/catalog/docs/infinispan-component.adoc | 4 ++-- .../camel/catalog/docs/infinispan-embedded-component.adoc | 4 ++-- .../src/main/docs/infinispan-embedded-component.adoc | 4 ++-- .../camel-infinispan/src/main/docs/infinispan-component.adoc | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc index 5375ad99dfb0d..62fa91181f52d 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc @@ -207,8 +207,8 @@ The `key` option of the endpoint takes precedence over the `CamelInfinispanKey` The `CamelInfinispanCacheName` header takes precedence over the cache name of the endpoint. -A `infinispan` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. -When a route sends those events to a `infinispan` producer, the producer works on the cache of the event, and on the key +An `infinispan` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. +When a route sends those events to an `infinispan` producer, the producer works on the cache of the event, and on the key of the event unless the endpoint sets `key`. To use the cache and the key configured on the producer endpoint, remove the headers first: diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc index 2a16bb5046115..17a803fd1a34a 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc @@ -221,8 +221,8 @@ The `key` option of the endpoint takes precedence over the `CamelInfinispanKey` The `CamelInfinispanCacheName` header takes precedence over the cache name of the endpoint. -A `infinispan-embedded` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. -When a route sends those events to a `infinispan-embedded` producer, the producer works on the cache of the event, and on the key +An `infinispan-embedded` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. +When a route sends those events to an `infinispan-embedded` producer, the producer works on the cache of the event, and on the key of the event unless the endpoint sets `key`. To use the cache and the key configured on the producer endpoint, remove the headers first: diff --git a/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc b/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc index 2a16bb5046115..17a803fd1a34a 100644 --- a/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc +++ b/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc @@ -221,8 +221,8 @@ The `key` option of the endpoint takes precedence over the `CamelInfinispanKey` The `CamelInfinispanCacheName` header takes precedence over the cache name of the endpoint. -A `infinispan-embedded` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. -When a route sends those events to a `infinispan-embedded` producer, the producer works on the cache of the event, and on the key +An `infinispan-embedded` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. +When a route sends those events to an `infinispan-embedded` producer, the producer works on the cache of the event, and on the key of the event unless the endpoint sets `key`. To use the cache and the key configured on the producer endpoint, remove the headers first: diff --git a/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc b/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc index 5375ad99dfb0d..62fa91181f52d 100644 --- a/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc +++ b/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc @@ -207,8 +207,8 @@ The `key` option of the endpoint takes precedence over the `CamelInfinispanKey` The `CamelInfinispanCacheName` header takes precedence over the cache name of the endpoint. -A `infinispan` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. -When a route sends those events to a `infinispan` producer, the producer works on the cache of the event, and on the key +An `infinispan` consumer sets `CamelInfinispanKey` and `CamelInfinispanCacheName` to the key and the cache of the event. +When a route sends those events to an `infinispan` producer, the producer works on the cache of the event, and on the key of the event unless the endpoint sets `key`. To use the cache and the key configured on the producer endpoint, remove the headers first: From 8effff313d279b5d38d0a9c68f0dac47fbbc4ae8 Mon Sep 17 00:00:00 2001 From: croway Date: Wed, 21 Oct 2026 10:27:23 +0200 Subject: [PATCH 3/4] CAMEL-25879: camel-infinispan - address review: runnable docs snippet, key precedence in the option description and the upgrade note - the docs snippet sets a value, since a PUT without one fails on an embedded cache - the key option description and the getKey() Javadoc state that key wins over the CamelInfinispanKey header - the upgrade note says the CamelInfinispanCacheName header still wins, and moves away from the end of the file --- .../components/infinispan-embedded.json | 4 ++-- .../camel/catalog/components/infinispan.json | 4 ++-- .../catalog/docs/infinispan-component.adoc | 2 +- .../docs/infinispan-embedded-component.adoc | 2 +- .../infinispan/InfinispanConfiguration.java | 3 ++- .../infinispan/InfinispanProducer.java | 6 ++++- .../embedded/infinispan-embedded.json | 4 ++-- .../docs/infinispan-embedded-component.adoc | 2 +- .../infinispan/remote/infinispan.json | 4 ++-- .../src/main/docs/infinispan-component.adoc | 2 +- .../pages/camel-4x-upgrade-guide-4_24.adoc | 24 +++++++++++-------- ...inispanEmbeddedEndpointBuilderFactory.java | 6 +++-- ...nfinispanRemoteEndpointBuilderFactory.java | 6 +++-- 13 files changed, 41 insertions(+), 28 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan-embedded.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan-embedded.json index c50ae628c8993..b884448a4a183 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan-embedded.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan-embedded.json @@ -32,7 +32,7 @@ "eventTypes": { "index": 5, "kind": "property", "displayName": "Event Types", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Specifies the set of event types to register by the consumer.Multiple event can be separated by comma. The possible event types are: CACHE_ENTRY_ACTIVATED, CACHE_ENTRY_PASSIVATED, CACHE_ENTRY_VISITED, CACHE_ENTRY_LOADED, CACHE_ENTRY_EVICTED, CACHE_ENTRY_CREATED, CACHE_ENTRY_REMOVED, CACHE_ENTRY_MODIFIED, TRANSACTION_COMPLETED, TRANSACTION_REGISTERED, CACHE_ENTRY_INVALIDATED, CACHE_ENTRY_EXPIRED, DATA_REHASHED, TOPOLOGY_CHANGED, PARTITION_STATUS_CHANGED, PERSISTENCE_AVAILABILITY_CHANGED" }, "sync": { "index": 6, "kind": "property", "displayName": "Sync", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "If true, the consumer will receive notifications synchronously" }, "defaultValue": { "index": 7, "kind": "property", "displayName": "Default Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific default value for some producer operations" }, - "key": { "index": 8, "kind": "property", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations" }, + "key": { "index": 8, "kind": "property", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header." }, "lazyStartProducer": { "index": 9, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }, "oldValue": { "index": 10, "kind": "property", "displayName": "Old Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific old value for some producer operations" }, "operation": { "index": 11, "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.infinispan.InfinispanOperation", "enum": [ "PUT", "PUTASYNC", "PUTALL", "PUTALLASYNC", "PUTIFABSENT", "PUTIFABSENTASYNC", "GET", "GETORDEFAULT", "CONTAINSKEY", "CONTAINSVALUE", "REMOVE", "REMOVEASYNC", "REPLACE", "REPLACEASYNC", "SIZE", "CLEAR", "CLEARASYNC", "QUERY", "STATS", "COMPUTE", "COMPUTEASYNC" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PUT", "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, @@ -80,7 +80,7 @@ "exceptionHandler": { "index": 7, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, "exchangePattern": { "index": 8, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "defaultValue": { "index": 9, "kind": "parameter", "displayName": "Default Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific default value for some producer operations" }, - "key": { "index": 10, "kind": "parameter", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations" }, + "key": { "index": 10, "kind": "parameter", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header." }, "oldValue": { "index": 11, "kind": "parameter", "displayName": "Old Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific old value for some producer operations" }, "operation": { "index": 12, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.infinispan.InfinispanOperation", "enum": [ "PUT", "PUTASYNC", "PUTALL", "PUTALLASYNC", "PUTIFABSENT", "PUTIFABSENTASYNC", "GET", "GETORDEFAULT", "CONTAINSKEY", "CONTAINSVALUE", "REMOVE", "REMOVEASYNC", "REPLACE", "REPLACEASYNC", "SIZE", "CLEAR", "CLEARASYNC", "QUERY", "STATS", "COMPUTE", "COMPUTEASYNC" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PUT", "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, "value": { "index": 13, "kind": "parameter", "displayName": "Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific value for producer operations" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan.json index 39e6f3ebde04f..f203e7c390228 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan.json @@ -31,7 +31,7 @@ "customListener": { "index": 4, "kind": "property", "displayName": "Custom Listener", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "org.apache.camel.component.infinispan.remote.InfinispanRemoteCustomListener", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Returns the custom listener in use, if provided" }, "eventTypes": { "index": 5, "kind": "property", "displayName": "Event Types", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Specifies the set of event types to register by the consumer.Multiple event can be separated by comma. The possible event types are: CLIENT_CACHE_ENTRY_CREATED, CLIENT_CACHE_ENTRY_MODIFIED, CLIENT_CACHE_ENTRY_REMOVED, CLIENT_CACHE_ENTRY_EXPIRED, CLIENT_CACHE_FAILOVER" }, "defaultValue": { "index": 6, "kind": "property", "displayName": "Default Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific default value for some producer operations" }, - "key": { "index": 7, "kind": "property", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations" }, + "key": { "index": 7, "kind": "property", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header." }, "lazyStartProducer": { "index": 8, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }, "oldValue": { "index": 9, "kind": "property", "displayName": "Old Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific old value for some producer operations" }, "operation": { "index": 10, "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.infinispan.InfinispanOperation", "enum": [ "PUT", "PUTASYNC", "PUTALL", "PUTALLASYNC", "PUTIFABSENT", "PUTIFABSENTASYNC", "GET", "GETORDEFAULT", "CONTAINSKEY", "CONTAINSVALUE", "REMOVE", "REMOVEASYNC", "REPLACE", "REPLACEASYNC", "SIZE", "CLEAR", "CLEARASYNC", "QUERY", "STATS", "COMPUTE", "COMPUTEASYNC" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PUT", "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, @@ -88,7 +88,7 @@ "exceptionHandler": { "index": 6, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, "exchangePattern": { "index": 7, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "defaultValue": { "index": 8, "kind": "parameter", "displayName": "Default Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific default value for some producer operations" }, - "key": { "index": 9, "kind": "parameter", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations" }, + "key": { "index": 9, "kind": "parameter", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header." }, "oldValue": { "index": 10, "kind": "parameter", "displayName": "Old Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific old value for some producer operations" }, "operation": { "index": 11, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.infinispan.InfinispanOperation", "enum": [ "PUT", "PUTASYNC", "PUTALL", "PUTALLASYNC", "PUTIFABSENT", "PUTIFABSENTASYNC", "GET", "GETORDEFAULT", "CONTAINSKEY", "CONTAINSVALUE", "REMOVE", "REMOVEASYNC", "REPLACE", "REPLACEASYNC", "SIZE", "CLEAR", "CLEARASYNC", "QUERY", "STATS", "COMPUTE", "COMPUTEASYNC" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PUT", "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, "value": { "index": 12, "kind": "parameter", "displayName": "Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific value for producer operations" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc index 62fa91181f52d..829f22845288a 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc @@ -216,7 +216,7 @@ the headers first: ---- from("infinispan:source") .removeHeaders("CamelInfinispan*") - .to("infinispan:target?operation=PUT&key=myKey"); + .to("infinispan:target?operation=PUT&key=myKey&value=myValue"); ---- == Examples diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc index 17a803fd1a34a..3221910ea61bc 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc @@ -230,7 +230,7 @@ the headers first: ---- from("infinispan-embedded:source") .removeHeaders("CamelInfinispan*") - .to("infinispan-embedded:target?operation=PUT&key=myKey"); + .to("infinispan-embedded:target?operation=PUT&key=myKey&value=myValue"); ---- == Examples diff --git a/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java b/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java index 0a96215cfab6f..297894cc2cac0 100644 --- a/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java +++ b/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java @@ -26,7 +26,8 @@ public abstract class InfinispanConfiguration { enums = "PUT,PUTASYNC,PUTALL,PUTALLASYNC,PUTIFABSENT,PUTIFABSENTASYNC,GET,GETORDEFAULT,CONTAINSKEY,CONTAINSVALUE,REMOVE,REMOVEASYNC,REPLACE,REPLACEASYNC,SIZE,CLEAR,CLEARASYNC,QUERY,STATS,COMPUTE,COMPUTEASYNC") private InfinispanOperation operation = InfinispanOperation.PUT; - @UriParam(label = "producer", description = "Set a specific key for producer operations") + @UriParam(label = "producer", + description = "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header.") private Object key; @UriParam(label = "producer", description = "Set a specific value for producer operations") diff --git a/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java b/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java index 552cd44c640a4..21b394bc890ad 100644 --- a/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java +++ b/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanProducer.java @@ -420,8 +420,12 @@ protected BasicCache getCache(Message message) { return manager.getCache(message, this.cacheName); } + /** + * Resolves the cache key: the key configured on the endpoint takes precedence over the + * {@link InfinispanConstants#KEY} header. Note that {@link #getCache(Message)} uses the opposite precedence: the + * {@link InfinispanConstants#CACHE_NAME} header wins over the cache of the endpoint. + */ protected Object getKey(Message message) { - // the key configured on the endpoint wins over the header Object key = configuration.getKey(); return key != null ? key : message.getHeader(InfinispanConstants.KEY); } diff --git a/components/camel-infinispan/camel-infinispan-embedded/src/generated/resources/META-INF/org/apache/camel/component/infinispan/embedded/infinispan-embedded.json b/components/camel-infinispan/camel-infinispan-embedded/src/generated/resources/META-INF/org/apache/camel/component/infinispan/embedded/infinispan-embedded.json index c50ae628c8993..b884448a4a183 100644 --- a/components/camel-infinispan/camel-infinispan-embedded/src/generated/resources/META-INF/org/apache/camel/component/infinispan/embedded/infinispan-embedded.json +++ b/components/camel-infinispan/camel-infinispan-embedded/src/generated/resources/META-INF/org/apache/camel/component/infinispan/embedded/infinispan-embedded.json @@ -32,7 +32,7 @@ "eventTypes": { "index": 5, "kind": "property", "displayName": "Event Types", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Specifies the set of event types to register by the consumer.Multiple event can be separated by comma. The possible event types are: CACHE_ENTRY_ACTIVATED, CACHE_ENTRY_PASSIVATED, CACHE_ENTRY_VISITED, CACHE_ENTRY_LOADED, CACHE_ENTRY_EVICTED, CACHE_ENTRY_CREATED, CACHE_ENTRY_REMOVED, CACHE_ENTRY_MODIFIED, TRANSACTION_COMPLETED, TRANSACTION_REGISTERED, CACHE_ENTRY_INVALIDATED, CACHE_ENTRY_EXPIRED, DATA_REHASHED, TOPOLOGY_CHANGED, PARTITION_STATUS_CHANGED, PERSISTENCE_AVAILABILITY_CHANGED" }, "sync": { "index": 6, "kind": "property", "displayName": "Sync", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "If true, the consumer will receive notifications synchronously" }, "defaultValue": { "index": 7, "kind": "property", "displayName": "Default Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific default value for some producer operations" }, - "key": { "index": 8, "kind": "property", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations" }, + "key": { "index": 8, "kind": "property", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header." }, "lazyStartProducer": { "index": 9, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }, "oldValue": { "index": 10, "kind": "property", "displayName": "Old Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific old value for some producer operations" }, "operation": { "index": 11, "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.infinispan.InfinispanOperation", "enum": [ "PUT", "PUTASYNC", "PUTALL", "PUTALLASYNC", "PUTIFABSENT", "PUTIFABSENTASYNC", "GET", "GETORDEFAULT", "CONTAINSKEY", "CONTAINSVALUE", "REMOVE", "REMOVEASYNC", "REPLACE", "REPLACEASYNC", "SIZE", "CLEAR", "CLEARASYNC", "QUERY", "STATS", "COMPUTE", "COMPUTEASYNC" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PUT", "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, @@ -80,7 +80,7 @@ "exceptionHandler": { "index": 7, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, "exchangePattern": { "index": 8, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "defaultValue": { "index": 9, "kind": "parameter", "displayName": "Default Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific default value for some producer operations" }, - "key": { "index": 10, "kind": "parameter", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations" }, + "key": { "index": 10, "kind": "parameter", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header." }, "oldValue": { "index": 11, "kind": "parameter", "displayName": "Old Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific old value for some producer operations" }, "operation": { "index": 12, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.infinispan.InfinispanOperation", "enum": [ "PUT", "PUTASYNC", "PUTALL", "PUTALLASYNC", "PUTIFABSENT", "PUTIFABSENTASYNC", "GET", "GETORDEFAULT", "CONTAINSKEY", "CONTAINSVALUE", "REMOVE", "REMOVEASYNC", "REPLACE", "REPLACEASYNC", "SIZE", "CLEAR", "CLEARASYNC", "QUERY", "STATS", "COMPUTE", "COMPUTEASYNC" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PUT", "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, "value": { "index": 13, "kind": "parameter", "displayName": "Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Set a specific value for producer operations" }, diff --git a/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc b/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc index 17a803fd1a34a..3221910ea61bc 100644 --- a/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc +++ b/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc @@ -230,7 +230,7 @@ the headers first: ---- from("infinispan-embedded:source") .removeHeaders("CamelInfinispan*") - .to("infinispan-embedded:target?operation=PUT&key=myKey"); + .to("infinispan-embedded:target?operation=PUT&key=myKey&value=myValue"); ---- == Examples diff --git a/components/camel-infinispan/camel-infinispan/src/generated/resources/META-INF/org/apache/camel/component/infinispan/remote/infinispan.json b/components/camel-infinispan/camel-infinispan/src/generated/resources/META-INF/org/apache/camel/component/infinispan/remote/infinispan.json index 39e6f3ebde04f..f203e7c390228 100644 --- a/components/camel-infinispan/camel-infinispan/src/generated/resources/META-INF/org/apache/camel/component/infinispan/remote/infinispan.json +++ b/components/camel-infinispan/camel-infinispan/src/generated/resources/META-INF/org/apache/camel/component/infinispan/remote/infinispan.json @@ -31,7 +31,7 @@ "customListener": { "index": 4, "kind": "property", "displayName": "Custom Listener", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "org.apache.camel.component.infinispan.remote.InfinispanRemoteCustomListener", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Returns the custom listener in use, if provided" }, "eventTypes": { "index": 5, "kind": "property", "displayName": "Event Types", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Specifies the set of event types to register by the consumer.Multiple event can be separated by comma. The possible event types are: CLIENT_CACHE_ENTRY_CREATED, CLIENT_CACHE_ENTRY_MODIFIED, CLIENT_CACHE_ENTRY_REMOVED, CLIENT_CACHE_ENTRY_EXPIRED, CLIENT_CACHE_FAILOVER" }, "defaultValue": { "index": 6, "kind": "property", "displayName": "Default Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific default value for some producer operations" }, - "key": { "index": 7, "kind": "property", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations" }, + "key": { "index": 7, "kind": "property", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header." }, "lazyStartProducer": { "index": 8, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }, "oldValue": { "index": 9, "kind": "property", "displayName": "Old Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific old value for some producer operations" }, "operation": { "index": 10, "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.infinispan.InfinispanOperation", "enum": [ "PUT", "PUTASYNC", "PUTALL", "PUTALLASYNC", "PUTIFABSENT", "PUTIFABSENTASYNC", "GET", "GETORDEFAULT", "CONTAINSKEY", "CONTAINSVALUE", "REMOVE", "REMOVEASYNC", "REPLACE", "REPLACEASYNC", "SIZE", "CLEAR", "CLEARASYNC", "QUERY", "STATS", "COMPUTE", "COMPUTEASYNC" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PUT", "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, @@ -88,7 +88,7 @@ "exceptionHandler": { "index": 6, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, "exchangePattern": { "index": 7, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "defaultValue": { "index": 8, "kind": "parameter", "displayName": "Default Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific default value for some producer operations" }, - "key": { "index": 9, "kind": "parameter", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations" }, + "key": { "index": 9, "kind": "parameter", "displayName": "Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific key for producer operations. When set, it takes precedence over the CamelInfinispanKey header." }, "oldValue": { "index": 10, "kind": "parameter", "displayName": "Old Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific old value for some producer operations" }, "operation": { "index": 11, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.infinispan.InfinispanOperation", "enum": [ "PUT", "PUTASYNC", "PUTALL", "PUTALLASYNC", "PUTIFABSENT", "PUTIFABSENTASYNC", "GET", "GETORDEFAULT", "CONTAINSKEY", "CONTAINSVALUE", "REMOVE", "REMOVEASYNC", "REPLACE", "REPLACEASYNC", "SIZE", "CLEAR", "CLEARASYNC", "QUERY", "STATS", "COMPUTE", "COMPUTEASYNC" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "PUT", "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "The operation to perform" }, "value": { "index": 12, "kind": "parameter", "displayName": "Value", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Set a specific value for producer operations" }, diff --git a/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc b/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc index 62fa91181f52d..829f22845288a 100644 --- a/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc +++ b/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc @@ -216,7 +216,7 @@ the headers first: ---- from("infinispan:source") .removeHeaders("CamelInfinispan*") - .to("infinispan:target?operation=PUT&key=myKey"); + .to("infinispan:target?operation=PUT&key=myKey&value=myValue"); ---- == Examples diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc index 947339c007de5..2939581a67dbd 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc @@ -2183,6 +2183,20 @@ and the delay between two connection attempts stayed 10 seconds. It now sets tha delay, and a value of 0 or less is rejected. To set the request timeout, use the `requestTimeout` option instead (for example `camel.component.milo-client.requestTimeout`, or `getConfiguration().setRequestTimeout(...)` in Java). +=== camel-infinispan - the key option of the producer takes precedence over the key header + +The `infinispan` and `infinispan-embedded` producers now use the `key` option of the endpoint when it is set, and use the +`CamelInfinispanKey` header only when the endpoint does not set `key`. Previously the header took precedence over the +option, so a route that sent the events of an Infinispan consumer, which set `CamelInfinispanKey` to the key of the event, +to a producer with a fixed `key` worked on the key of the event. + +Routes that set `key` on the endpoint and override it per message with the `CamelInfinispanKey` header must remove `key` +from the endpoint. + +The `CamelInfinispanCacheName` header still takes precedence over the cache of the endpoint, so a route that sends the +events of an Infinispan consumer to a producer must still remove the `CamelInfinispan*` headers first, see _Key and cache +name headers_ in the component docs. + === camel-protobuf - a bytes field in a Map When a protobuf message is converted to a `Map` (for example `getBody(Map.class)` after unmarshalling), the value of @@ -2316,13 +2330,3 @@ a keep-alive message that does not wait for a reply, so it does not find such a noop is a request that waits for the reply, so with `sendNoop=false` such a connection is found by the next poll, which fails and is logged before the consumer connects again. For sftp and mina-sftp, set `serverAliveInterval` to let the client close such a connection itself, so that the consumer connects again before the poll. - -=== camel-infinispan - the key option of the producer takes precedence over the key header - -The `infinispan` and `infinispan-embedded` producers now use the `key` option of the endpoint when it is set, and use the -`CamelInfinispanKey` header only when the endpoint does not set `key`. Previously the header took precedence over the -option, so a route that sent the events of an Infinispan consumer, which set `CamelInfinispanKey` to the key of the event, -to a producer with a fixed `key` worked on the key of the event. - -Routes that set `key` on the endpoint and override it per message with the `CamelInfinispanKey` header must remove `key` -from the endpoint. diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfinispanEmbeddedEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfinispanEmbeddedEndpointBuilderFactory.java index c2380faa2ac95..25d9022d1cafa 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfinispanEmbeddedEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfinispanEmbeddedEndpointBuilderFactory.java @@ -526,7 +526,8 @@ default InfinispanEmbeddedEndpointProducerBuilder defaultValue(String defaultVal return this; } /** - * Set a specific key for producer operations. + * Set a specific key for producer operations. When set, it takes + * precedence over the CamelInfinispanKey header. * * The option is a: java.lang.Object type. * @@ -540,7 +541,8 @@ default InfinispanEmbeddedEndpointProducerBuilder key(Object key) { return this; } /** - * Set a specific key for producer operations. + * Set a specific key for producer operations. When set, it takes + * precedence over the CamelInfinispanKey header. * * The option will be converted to a java.lang.Object type. * diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfinispanRemoteEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfinispanRemoteEndpointBuilderFactory.java index 74729d024de2c..0369b8a69eb4e 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfinispanRemoteEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfinispanRemoteEndpointBuilderFactory.java @@ -626,7 +626,8 @@ default InfinispanRemoteEndpointProducerBuilder defaultValue(String defaultValue return this; } /** - * Set a specific key for producer operations. + * Set a specific key for producer operations. When set, it takes + * precedence over the CamelInfinispanKey header. * * The option is a: java.lang.Object type. * @@ -640,7 +641,8 @@ default InfinispanRemoteEndpointProducerBuilder key(Object key) { return this; } /** - * Set a specific key for producer operations. + * Set a specific key for producer operations. When set, it takes + * precedence over the CamelInfinispanKey header. * * The option will be converted to a java.lang.Object type. * From 57b0228361c9ad04bd63bc54d00d0c9a2b0ca22e Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Wed, 21 Oct 2026 09:56:47 +0000 Subject: [PATCH 4/4] Regen --- .../component/dsl/InfinispanComponentBuilderFactory.java | 3 ++- .../dsl/InfinispanEmbeddedComponentBuilderFactory.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/InfinispanComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/InfinispanComponentBuilderFactory.java index a876ef1b8b2fe..d153a473c8eb0 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/InfinispanComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/InfinispanComponentBuilderFactory.java @@ -178,7 +178,8 @@ default InfinispanComponentBuilder defaultValue(java.lang.Object defaultValue) { } /** - * Set a specific key for producer operations. + * Set a specific key for producer operations. When set, it takes + * precedence over the CamelInfinispanKey header. * * The option is a: <code>java.lang.Object</code> type. * diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/InfinispanEmbeddedComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/InfinispanEmbeddedComponentBuilderFactory.java index 51039f0b87280..7ca53573a997b 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/InfinispanEmbeddedComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/InfinispanEmbeddedComponentBuilderFactory.java @@ -199,7 +199,8 @@ default InfinispanEmbeddedComponentBuilder defaultValue(java.lang.Object default } /** - * Set a specific key for producer operations. + * Set a specific key for producer operations. When set, it takes + * precedence over the CamelInfinispanKey header. * * The option is a: <code>java.lang.Object</code> type. *