This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 5ef2bcb77529 CAMEL-24463: Deprecate MemoryIdempotentRepository and
MemoryAggregationRepository
5ef2bcb77529 is described below
commit 5ef2bcb77529d60ba3974cdc01c278e0ec9218ca
Author: Guillaume Nodet <[email protected]>
AuthorDate: Tue Sep 1 07:53:32 2026 +0200
CAMEL-24463: Deprecate MemoryIdempotentRepository and
MemoryAggregationRepository
Co-authored-by: Claude Opus 4.6 <[email protected]>
* CAMEL-24463: Deprecate MemoryIdempotentRepository and
MemoryAggregationRepository
Deprecate MemoryIdempotentRepository and MemoryAggregationRepository in
favor
of KeyValueIdempotentRepository and KeyValueAggregationRepository wrapping
MemoryKeyValueRepository. This is a follow-up to the KeyValueRepository SPI
introduced in PR #25631.
The deprecated classes continue to work but users are encouraged to migrate
to
the new KeyValue-based replacements which provide a uniform abstraction
that can
be backed by any store (in-memory, Redis, JDBC, etc.).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* CAMEL-24463: Add Spring XML / Blueprint DSL migration examples to upgrade
guide
Extend the deprecation upgrade guide entry with Spring XML bean definition
examples showing how to replace the deprecated MemoryIdempotentRepository
and MemoryAggregationRepository beans with the KeyValue-based alternatives
using constructor injection.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* CAMEL-24463: Include catalog-level generated JSON for deprecated beans
The CI "uncommitted changes" check regenerates the catalog during the
build. The catalog bean JSON copies under catalog/camel-catalog/ must
also reflect deprecated: true, matching the module-level copies already
committed.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* CAMEL-24463: Use plain Camel XML DSL syntax in upgrade guide examples
Replace Spring XML bean syntax (id/class/constructor-arg) with Camel's
own XML DSL syntax (name/type/constructors) since that is what most
users write today.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* CAMEL-24463: Add no-arg constructor and tooling annotations to KV adapters
KeyValueIdempotentRepository and KeyValueAggregationRepository now
default to MemoryKeyValueRepository when created with the no-arg
constructor, reducing migration boilerplate from two classes to one.
Added @Metadata and @Configurer annotations so both adapters are
auto-discoverable in XML/YAML DSL and tooling (catalog, JBang).
Updated upgrade guide with simpler migration examples.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* CAMEL-24463: Include generated beans.properties for catalog
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>
---
.../org/apache/camel/catalog/beans.properties | 2 +
.../beans/KeyValueAggregationRepository.json | 15 ++++
.../beans/KeyValueIdempotentRepository.json | 15 ++++
.../catalog/beans/MemoryAggregationRepository.json | 2 +-
.../catalog/beans/MemoryIdempotentRepository.json | 2 +-
.../camel/bean/MemoryAggregationRepository.json | 2 +-
.../aggregate/MemoryAggregationRepository.java | 4 ++
.../KeyValueAggregationRepositoryConfigurer.java | 37 ++++++++++
.../KeyValueIdempotentRepositoryConfigurer.java | 37 ++++++++++
.../services/org/apache/camel/bean.properties | 2 +-
.../camel/bean/KeyValueAggregationRepository.json | 15 ++++
.../camel/bean/KeyValueIdempotentRepository.json | 15 ++++
.../camel/bean/MemoryIdempotentRepository.json | 2 +-
...che.camel.support.KeyValueAggregationRepository | 2 +
...ache.camel.support.KeyValueIdempotentRepository | 2 +
.../support/KeyValueAggregationRepository.java | 32 ++++++++-
.../support/KeyValueIdempotentRepository.java | 32 ++++++++-
.../idempotent/MemoryIdempotentRepository.java | 4 ++
.../ROOT/pages/camel-4x-upgrade-guide-4_23.adoc | 83 ++++++++++++++++++++++
19 files changed, 298 insertions(+), 7 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans.properties
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans.properties
index d355b8bfd5e8..ef75beaeb981 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans.properties
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans.properties
@@ -30,6 +30,8 @@ JGroupsRaftClusterService
JdbcAggregationRepository
JdbcMessageIdRepository
KafkaIdempotentRepository
+KeyValueAggregationRepository
+KeyValueIdempotentRepository
KubernetesClusterService
LoggingHttpActivityListener
MemoryAggregationRepository
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/KeyValueAggregationRepository.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/KeyValueAggregationRepository.json
new file mode 100644
index 000000000000..84f9bc8c5ddf
--- /dev/null
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/KeyValueAggregationRepository.json
@@ -0,0 +1,15 @@
+{
+ "bean": {
+ "kind": "bean",
+ "name": "KeyValueAggregationRepository",
+ "javaType": "org.apache.camel.support.KeyValueAggregationRepository",
+ "interfaceType": "org.apache.camel.spi.AggregationRepository",
+ "title": "Key Value Aggregation Repository",
+ "description": "An AggregationRepository backed by a KeyValueRepository
(defaults to in-memory).",
+ "deprecated": false,
+ "groupId": "org.apache.camel",
+ "artifactId": "camel-support",
+ "version": "4.23.0-SNAPSHOT"
+ }
+}
+
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/KeyValueIdempotentRepository.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/KeyValueIdempotentRepository.json
new file mode 100644
index 000000000000..601d93e69324
--- /dev/null
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/KeyValueIdempotentRepository.json
@@ -0,0 +1,15 @@
+{
+ "bean": {
+ "kind": "bean",
+ "name": "KeyValueIdempotentRepository",
+ "javaType": "org.apache.camel.support.KeyValueIdempotentRepository",
+ "interfaceType": "org.apache.camel.spi.IdempotentRepository",
+ "title": "Key Value Idempotent Repository",
+ "description": "An IdempotentRepository backed by a KeyValueRepository
(defaults to in-memory).",
+ "deprecated": false,
+ "groupId": "org.apache.camel",
+ "artifactId": "camel-support",
+ "version": "4.23.0-SNAPSHOT"
+ }
+}
+
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/MemoryAggregationRepository.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/MemoryAggregationRepository.json
index 16fc81255246..db86a28c9e61 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/MemoryAggregationRepository.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/MemoryAggregationRepository.json
@@ -6,7 +6,7 @@
"interfaceType": "org.apache.camel.spi.AggregationRepository",
"title": "Memory Aggregation Repository",
"description": "A memory based AggregationRepository which stores Exchange
in memory only.",
- "deprecated": false,
+ "deprecated": true,
"groupId": "org.apache.camel",
"artifactId": "camel-core-processor",
"version": "4.23.0-SNAPSHOT",
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/MemoryIdempotentRepository.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/MemoryIdempotentRepository.json
index 690e62c15fc0..cfac3f088734 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/MemoryIdempotentRepository.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/MemoryIdempotentRepository.json
@@ -6,7 +6,7 @@
"interfaceType": "org.apache.camel.spi.IdempotentRepository",
"title": "Memory Idempotent Repository",
"description": "A memory based IdempotentRepository.",
- "deprecated": false,
+ "deprecated": true,
"groupId": "org.apache.camel",
"artifactId": "camel-support",
"version": "4.23.0-SNAPSHOT",
diff --git
a/core/camel-core-processor/src/generated/resources/META-INF/services/org/apache/camel/bean/MemoryAggregationRepository.json
b/core/camel-core-processor/src/generated/resources/META-INF/services/org/apache/camel/bean/MemoryAggregationRepository.json
index 16fc81255246..db86a28c9e61 100644
---
a/core/camel-core-processor/src/generated/resources/META-INF/services/org/apache/camel/bean/MemoryAggregationRepository.json
+++
b/core/camel-core-processor/src/generated/resources/META-INF/services/org/apache/camel/bean/MemoryAggregationRepository.json
@@ -6,7 +6,7 @@
"interfaceType": "org.apache.camel.spi.AggregationRepository",
"title": "Memory Aggregation Repository",
"description": "A memory based AggregationRepository which stores Exchange
in memory only.",
- "deprecated": false,
+ "deprecated": true,
"groupId": "org.apache.camel",
"artifactId": "camel-core-processor",
"version": "4.23.0-SNAPSHOT",
diff --git
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java
index 62b0946f4d53..47344e2f87b7 100644
---
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java
+++
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java
@@ -32,7 +32,11 @@ import org.apache.camel.support.service.ServiceSupport;
* A memory based {@link org.apache.camel.spi.AggregationRepository} which
stores {@link Exchange}s in memory only.
*
* Supports both optimistic locking and non-optimistic locking modes. Defaults
to non-optimistic locking mode.
+ *
+ * @deprecated since 4.23.0. Use {@link
org.apache.camel.support.KeyValueAggregationRepository} instead. The no-arg
+ * constructor defaults to an in-memory store: {@code new
KeyValueAggregationRepository()}
*/
+@Deprecated(since = "4.23.0")
@Metadata(label = "bean",
description = "A memory based AggregationRepository which stores
Exchange in memory only.",
annotations = {
"interfaceName=org.apache.camel.spi.AggregationRepository" })
diff --git
a/core/camel-support/src/generated/java/org/apache/camel/support/KeyValueAggregationRepositoryConfigurer.java
b/core/camel-support/src/generated/java/org/apache/camel/support/KeyValueAggregationRepositoryConfigurer.java
new file mode 100644
index 000000000000..b8c59f2bd254
--- /dev/null
+++
b/core/camel-support/src/generated/java/org/apache/camel/support/KeyValueAggregationRepositoryConfigurer.java
@@ -0,0 +1,37 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.support;
+
+import javax.annotation.processing.Generated;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.KeyValueAggregationRepository;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.GenerateConfigurerMojo")
+@SuppressWarnings("unchecked")
+public class KeyValueAggregationRepositoryConfigurer extends
org.apache.camel.support.component.PropertyConfigurerSupport implements
GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+ @Override
+ public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
+ return false;
+ }
+
+ @Override
+ public Class<?> getOptionType(String name, boolean ignoreCase) {
+ return null;
+ }
+
+ @Override
+ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+ return null;
+ }
+}
+
diff --git
a/core/camel-support/src/generated/java/org/apache/camel/support/KeyValueIdempotentRepositoryConfigurer.java
b/core/camel-support/src/generated/java/org/apache/camel/support/KeyValueIdempotentRepositoryConfigurer.java
new file mode 100644
index 000000000000..aa7c59ec632e
--- /dev/null
+++
b/core/camel-support/src/generated/java/org/apache/camel/support/KeyValueIdempotentRepositoryConfigurer.java
@@ -0,0 +1,37 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.support;
+
+import javax.annotation.processing.Generated;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.KeyValueIdempotentRepository;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.GenerateConfigurerMojo")
+@SuppressWarnings("unchecked")
+public class KeyValueIdempotentRepositoryConfigurer extends
org.apache.camel.support.component.PropertyConfigurerSupport implements
GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+ @Override
+ public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
+ return false;
+ }
+
+ @Override
+ public Class<?> getOptionType(String name, boolean ignoreCase) {
+ return null;
+ }
+
+ @Override
+ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+ return null;
+ }
+}
+
diff --git
a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean.properties
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean.properties
index 2b3850b73b6b..9faca19ade43 100644
---
a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean.properties
+++
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean.properties
@@ -1,5 +1,5 @@
# Generated by camel build tools - do NOT edit this file!
-bean=AcceptAllHeaderFilterStrategy DefaultHeaderFilterStrategy
FileIdempotentRepository MemoryIdempotentRepository MemoryKeyValueRepository
ThrottlingExceptionRoutePolicy ThrottlingInflightRoutePolicy
+bean=AcceptAllHeaderFilterStrategy DefaultHeaderFilterStrategy
FileIdempotentRepository KeyValueAggregationRepository
KeyValueIdempotentRepository MemoryIdempotentRepository
MemoryKeyValueRepository ThrottlingExceptionRoutePolicy
ThrottlingInflightRoutePolicy
groupId=org.apache.camel
artifactId=camel-support
version=4.23.0-SNAPSHOT
diff --git
a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/KeyValueAggregationRepository.json
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/KeyValueAggregationRepository.json
new file mode 100644
index 000000000000..84f9bc8c5ddf
--- /dev/null
+++
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/KeyValueAggregationRepository.json
@@ -0,0 +1,15 @@
+{
+ "bean": {
+ "kind": "bean",
+ "name": "KeyValueAggregationRepository",
+ "javaType": "org.apache.camel.support.KeyValueAggregationRepository",
+ "interfaceType": "org.apache.camel.spi.AggregationRepository",
+ "title": "Key Value Aggregation Repository",
+ "description": "An AggregationRepository backed by a KeyValueRepository
(defaults to in-memory).",
+ "deprecated": false,
+ "groupId": "org.apache.camel",
+ "artifactId": "camel-support",
+ "version": "4.23.0-SNAPSHOT"
+ }
+}
+
diff --git
a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/KeyValueIdempotentRepository.json
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/KeyValueIdempotentRepository.json
new file mode 100644
index 000000000000..601d93e69324
--- /dev/null
+++
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/KeyValueIdempotentRepository.json
@@ -0,0 +1,15 @@
+{
+ "bean": {
+ "kind": "bean",
+ "name": "KeyValueIdempotentRepository",
+ "javaType": "org.apache.camel.support.KeyValueIdempotentRepository",
+ "interfaceType": "org.apache.camel.spi.IdempotentRepository",
+ "title": "Key Value Idempotent Repository",
+ "description": "An IdempotentRepository backed by a KeyValueRepository
(defaults to in-memory).",
+ "deprecated": false,
+ "groupId": "org.apache.camel",
+ "artifactId": "camel-support",
+ "version": "4.23.0-SNAPSHOT"
+ }
+}
+
diff --git
a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/MemoryIdempotentRepository.json
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/MemoryIdempotentRepository.json
index 690e62c15fc0..cfac3f088734 100644
---
a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/MemoryIdempotentRepository.json
+++
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/bean/MemoryIdempotentRepository.json
@@ -6,7 +6,7 @@
"interfaceType": "org.apache.camel.spi.IdempotentRepository",
"title": "Memory Idempotent Repository",
"description": "A memory based IdempotentRepository.",
- "deprecated": false,
+ "deprecated": true,
"groupId": "org.apache.camel",
"artifactId": "camel-support",
"version": "4.23.0-SNAPSHOT",
diff --git
a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.support.KeyValueAggregationRepository
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.support.KeyValueAggregationRepository
new file mode 100644
index 000000000000..88f275ff23b9
--- /dev/null
+++
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.support.KeyValueAggregationRepository
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.support.KeyValueAggregationRepositoryConfigurer
diff --git
a/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.support.KeyValueIdempotentRepository
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.support.KeyValueIdempotentRepository
new file mode 100644
index 000000000000..df83a7a2e58e
--- /dev/null
+++
b/core/camel-support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.support.KeyValueIdempotentRepository
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.support.KeyValueIdempotentRepositoryConfigurer
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/KeyValueAggregationRepository.java
b/core/camel-support/src/main/java/org/apache/camel/support/KeyValueAggregationRepository.java
index da6dbb6ac269..bfa46ae46514 100644
---
a/core/camel-support/src/main/java/org/apache/camel/support/KeyValueAggregationRepository.java
+++
b/core/camel-support/src/main/java/org/apache/camel/support/KeyValueAggregationRepository.java
@@ -24,7 +24,9 @@ import java.util.stream.Collectors;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.Exchange;
+import org.apache.camel.spi.Configurer;
import org.apache.camel.spi.KeyValueRepository;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.RecoverableAggregationRepository;
import org.apache.camel.support.service.ServiceHelper;
import org.apache.camel.support.service.ServiceSupport;
@@ -41,9 +43,15 @@ import org.slf4j.LoggerFactory;
* <p/>
* This allows any {@link KeyValueRepository} implementation to be used as an
aggregation repository without
* implementing the {@link org.apache.camel.spi.AggregationRepository}
interface directly.
+ * <p/>
+ * When created with the no-arg constructor, a {@link
MemoryKeyValueRepository} is used by default.
*
* @since 4.23
*/
+@Metadata(label = "bean",
+ description = "An AggregationRepository backed by a
KeyValueRepository (defaults to in-memory).",
+ annotations = {
"interfaceName=org.apache.camel.spi.AggregationRepository" })
+@Configurer(metadataOnly = true)
public class KeyValueAggregationRepository extends ServiceSupport
implements RecoverableAggregationRepository, CamelContextAware {
@@ -60,7 +68,7 @@ public class KeyValueAggregationRepository extends
ServiceSupport
*/
private static final String COMPLETED_PREFIX = "completed:";
- private final KeyValueRepository repository;
+ private KeyValueRepository repository;
private CamelContext camelContext;
private boolean useRecovery = true;
private String deadLetterUri;
@@ -68,6 +76,16 @@ public class KeyValueAggregationRepository extends
ServiceSupport
private int maximumRedeliveries = 3;
private boolean allowSerializedHeaders;
+ /**
+ * Creates an aggregation repository adapter that defaults to an in-memory
{@link MemoryKeyValueRepository}. The
+ * repository is created lazily when the service starts.
+ * <p/>
+ * To use a custom {@link KeyValueRepository}, call {@link
#setRepository(KeyValueRepository)} before starting, or
+ * use the {@link #KeyValueAggregationRepository(KeyValueRepository)}
constructor.
+ */
+ public KeyValueAggregationRepository() {
+ }
+
/**
* Creates an aggregation repository adapter backed by the given key-value
repository.
*
@@ -207,6 +225,15 @@ public class KeyValueAggregationRepository extends
ServiceSupport
return repository;
}
+ /**
+ * Sets the underlying {@link KeyValueRepository}.
+ *
+ * @param repository the key-value repository to use
+ */
+ public void setRepository(KeyValueRepository repository) {
+ this.repository = repository;
+ }
+
@Override
public CamelContext getCamelContext() {
return camelContext;
@@ -219,6 +246,9 @@ public class KeyValueAggregationRepository extends
ServiceSupport
@Override
protected void doStart() throws Exception {
+ if (repository == null) {
+ repository = new MemoryKeyValueRepository();
+ }
ServiceHelper.startService(repository);
}
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/KeyValueIdempotentRepository.java
b/core/camel-support/src/main/java/org/apache/camel/support/KeyValueIdempotentRepository.java
index d08e4fc38418..010e913361a2 100644
---
a/core/camel-support/src/main/java/org/apache/camel/support/KeyValueIdempotentRepository.java
+++
b/core/camel-support/src/main/java/org/apache/camel/support/KeyValueIdempotentRepository.java
@@ -16,8 +16,10 @@
*/
package org.apache.camel.support;
+import org.apache.camel.spi.Configurer;
import org.apache.camel.spi.IdempotentRepository;
import org.apache.camel.spi.KeyValueRepository;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.support.service.ServiceHelper;
import org.apache.camel.support.service.ServiceSupport;
import org.apache.camel.util.ObjectHelper;
@@ -30,9 +32,15 @@ import org.apache.camel.util.ObjectHelper;
* <p/>
* This allows any {@link KeyValueRepository} implementation (e.g. backed by
Redis, Infinispan, JDBC, etc.) to be used
* as an idempotent repository without implementing the {@link
IdempotentRepository} interface directly.
+ * <p/>
+ * When created with the no-arg constructor, a {@link
MemoryKeyValueRepository} is used by default.
*
* @since 4.23
*/
+@Metadata(label = "bean",
+ description = "An IdempotentRepository backed by a
KeyValueRepository (defaults to in-memory).",
+ annotations = {
"interfaceName=org.apache.camel.spi.IdempotentRepository" })
+@Configurer(metadataOnly = true)
public class KeyValueIdempotentRepository extends ServiceSupport implements
IdempotentRepository {
/**
@@ -41,7 +49,17 @@ public class KeyValueIdempotentRepository extends
ServiceSupport implements Idem
*/
private static final String IDEMPOTENT_PREFIX = "idempotent:";
- private final KeyValueRepository repository;
+ private KeyValueRepository repository;
+
+ /**
+ * Creates an idempotent repository adapter that defaults to an in-memory
{@link MemoryKeyValueRepository}. The
+ * repository is created lazily when the service starts.
+ * <p/>
+ * To use a custom {@link KeyValueRepository}, call {@link
#setRepository(KeyValueRepository)} before starting, or
+ * use the {@link #KeyValueIdempotentRepository(KeyValueRepository)}
constructor.
+ */
+ public KeyValueIdempotentRepository() {
+ }
/**
* Creates an idempotent repository adapter backed by the given key-value
repository.
@@ -102,8 +120,20 @@ public class KeyValueIdempotentRepository extends
ServiceSupport implements Idem
return repository;
}
+ /**
+ * Sets the underlying {@link KeyValueRepository}.
+ *
+ * @param repository the key-value repository to use
+ */
+ public void setRepository(KeyValueRepository repository) {
+ this.repository = repository;
+ }
+
@Override
protected void doStart() throws Exception {
+ if (repository == null) {
+ repository = new MemoryKeyValueRepository();
+ }
ServiceHelper.startService(repository);
}
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/MemoryIdempotentRepository.java
b/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/MemoryIdempotentRepository.java
index 0e0f21be3db4..e4e9aa45fe58 100644
---
a/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/MemoryIdempotentRepository.java
+++
b/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/MemoryIdempotentRepository.java
@@ -37,7 +37,11 @@ import org.apache.camel.support.service.ServiceSupport;
* algorithm.
* <p/>
* Care should be taken to use a suitable underlying {@link Map} to avoid this
class being a memory leak.
+ *
+ * @deprecated since 4.23.0. Use {@link
org.apache.camel.support.KeyValueIdempotentRepository} instead. The no-arg
+ * constructor defaults to an in-memory store: {@code new
KeyValueIdempotentRepository()}
*/
+@Deprecated(since = "4.23.0")
@Metadata(label = "bean",
description = "A memory based IdempotentRepository.",
annotations = {
"interfaceName=org.apache.camel.spi.IdempotentRepository" })
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
index c193671874f8..387bcd0afffb 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
@@ -155,6 +155,88 @@ The component camel-threadpoolfactory-vertx was deprecated
in 4.21. The componen
`camel-zeebe` component was deprecated in 4.19 and has a straightforward
replacement with `camel-camunda`. It is removed in 4.23.
+=== camel-core - MemoryIdempotentRepository and MemoryAggregationRepository
deprecated
+
+`MemoryIdempotentRepository` and `MemoryAggregationRepository` are deprecated
in favor of the new
+`KeyValueIdempotentRepository` and `KeyValueAggregationRepository` adapters
wrapping a
+`MemoryKeyValueRepository`. The new classes delegate to the
`KeyValueRepository` SPI introduced in
+4.23, which provides a uniform key-value abstraction that can be backed by any
store (in-memory,
+Redis, JDBC, etc.).
+
+==== Java DSL
+
+To migrate from `MemoryIdempotentRepository`:
+
+[source,java]
+----
+// Before
+IdempotentRepository repo =
MemoryIdempotentRepository.memoryIdempotentRepository();
+
+// After (simple — defaults to in-memory)
+IdempotentRepository repo = new KeyValueIdempotentRepository();
+
+// After (explicit — useful when sharing a store or using a custom
KeyValueRepository)
+IdempotentRepository repo = new KeyValueIdempotentRepository(new
MemoryKeyValueRepository());
+----
+
+To migrate from `MemoryAggregationRepository`:
+
+[source,java]
+----
+// Before
+AggregationRepository repo = new MemoryAggregationRepository();
+
+// After (simple — defaults to in-memory)
+AggregationRepository repo = new KeyValueAggregationRepository();
+
+// After (explicit — useful when sharing a store or using a custom
KeyValueRepository)
+AggregationRepository repo = new KeyValueAggregationRepository(new
MemoryKeyValueRepository());
+----
+
+==== XML DSL
+
+If you define the repository as a bean in XML, a simple one-to-one replacement
is sufficient since
+the adapters default to an in-memory backing store:
+
+For idempotent consumers:
+
+[source,xml]
+----
+<!-- Before -->
+<bean name="myRepo"
type="org.apache.camel.support.processor.idempotent.MemoryIdempotentRepository"/>
+
+<!-- After -->
+<bean name="myRepo"
type="org.apache.camel.support.KeyValueIdempotentRepository"/>
+----
+
+For aggregation repositories:
+
+[source,xml]
+----
+<!-- Before -->
+<bean name="myRepo"
type="org.apache.camel.processor.aggregate.MemoryAggregationRepository"/>
+
+<!-- After -->
+<bean name="myRepo"
type="org.apache.camel.support.KeyValueAggregationRepository"/>
+----
+
+To use a custom `KeyValueRepository` (e.g. a shared store), define the backing
store separately:
+
+[source,xml]
+----
+<bean name="kvStore" type="org.apache.camel.support.MemoryKeyValueRepository"/>
+<bean name="myRepo"
type="org.apache.camel.support.KeyValueIdempotentRepository">
+ <constructors>
+ <constructor value="#kvStore"/>
+ </constructors>
+</bean>
+----
+
+The `idempotentRepository` and `aggregationRepository` attributes in the route
DSL remain
+unchanged — they still reference the bean by its name.
+
+The deprecated classes continue to work but will be removed in a future
release.
+
=== camel-core - endpoint URI normalization is now order-independent
`URISupport.normalizeUri()` computes the endpoint registry cache key so that
two logically identical
@@ -213,6 +295,7 @@ Documents carrying an internal DTD subset still parse:
`disallow-doctype-decl` i
set here, because that would reject input that parses today. Routes that
genuinely need to resolve
an external DTD or parameter entity through this converter must supply their
own
`SAXParserFactory`.
+
=== camel-tika
The Tika dependency has been upgraded from 3.x to 4.x. Tika 4 removed the
`TikaConfig` class and XML