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 66daeda29d6d CAMEL-24979: camel-core - Deprecate exchange pooling 
(#26821)
66daeda29d6d is described below

commit 66daeda29d6d619057854be2192687d6ed6ed339
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Sep 24 11:50:52 2026 +0200

    CAMEL-24979: camel-core - Deprecate exchange pooling (#26821)
    
    * CAMEL-24979: camel-core - Deprecate exchange pooling
    
    - Add @Deprecated(since="4.23.0") to PooledExchange, DefaultPooledExchange,
      PooledExchangeFactory, PooledProcessorExchangeFactory, 
PooledExchangeTaskFactory,
      PooledTaskFactory, CamelInternalPooledTaskFactory
    - Deprecate exchangeFactory, exchangeFactoryCapacity and
      exchangeFactoryStatisticsEnabled config properties in 
DefaultConfigurationProperties
      (fields, getters, setters, with* fluent methods)
    - Auto-regenerated camel-main-configuration-metadata.json marks the three
      properties as deprecated
    - Add WARN log in DefaultConfigurationConfigurer when exchangeFactory=pooled
    - Mark exchange-pooling.adoc as deprecated with a CAUTION block
    - Add upgrade guide entry in camel-4x-upgrade-guide-4_23.adoc
    
    Co-authored-by: Claude Sonnet 4 <[email protected]>
    
    * Regen
    
    * CAMEL-24979: address review issues
    
    - Add missing CamelInternalPooledTaskFactory and PooledExchangeTask to 
upgrade guide
    - Deprecate PooledExchangeTask interface (@Deprecated since 4.23.0)
    - Merge LOG.warn string literals into a single string
    
    ---------
    
    Co-authored-by: Claude Sonnet 4 <[email protected]>
---
 .../main/camel-main-configuration-metadata.json    |  6 ++--
 .../main/java/org/apache/camel/PooledExchange.java |  4 ++-
 .../engine/CamelInternalPooledTaskFactory.java     |  3 ++
 .../camel/impl/engine/PooledExchangeFactory.java   |  3 ++
 .../engine/PooledProcessorExchangeFactory.java     |  3 ++
 .../apache/camel/processor/PooledExchangeTask.java |  4 ++-
 .../camel/processor/PooledExchangeTaskFactory.java |  4 ++-
 .../apache/camel/processor/PooledTaskFactory.java  |  4 +++
 .../camel-main-configuration-metadata.json         |  6 ++--
 .../camel/main/DefaultConfigurationConfigurer.java |  2 ++
 .../camel/main/DefaultConfigurationProperties.java | 32 ++++++++++++++++++++++
 .../camel/support/DefaultPooledExchange.java       |  3 ++
 .../ROOT/pages/camel-4x-upgrade-guide-4_23.adoc    | 24 ++++++++++++++++
 .../modules/ROOT/pages/exchange-pooling.adoc       |  3 ++
 14 files changed, 92 insertions(+), 9 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index 561978a50e29..8d59e0dc9e73 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -79,9 +79,9 @@
     { "name": "camel.main.endpointBridgeErrorHandler", "required": false, 
"description": "Allows for bridging the consumer to the Camel routing Error 
Handler, which mean any exceptions occurred while the consumer is trying to 
pickup incoming messages, or the likes, will now be processed as a message and 
handled by the routing Error Handler. By default the consumer will use the 
org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be 
logged at WARN\/ERROR level and igno [...]
     { "name": "camel.main.endpointLazyStartProducer", "required": 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 [...]
     { "name": "camel.main.endpointRuntimeStatisticsEnabled", "required": 
false, "description": "Sets whether endpoint runtime statistics is enabled 
(gathers runtime usage of each incoming and outgoing endpoints). The default 
value is false.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": false, "secret": false },
-    { "name": "camel.main.exchangeFactory", "required": false, "description": 
"Controls whether to pool (reuse) exchanges or create new exchanges 
(prototype). Using pooled will reduce JVM garbage collection overhead by 
avoiding to re-create Exchange instances per message each consumer receives. 
The default is prototype mode.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "enum", 
"javaType": "java.lang.String", "defaultValue": "default", "secret": false, " 
[...]
-    { "name": "camel.main.exchangeFactoryCapacity", "required": false, 
"description": "The capacity the pool (for each consumer) uses for storing 
exchanges. The default capacity is 100.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 100, "secret": false },
-    { "name": "camel.main.exchangeFactoryStatisticsEnabled", "required": 
false, "description": "Configures whether statistics is enabled on exchange 
factory.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": false, "secret": false },
+    { "name": "camel.main.exchangeFactory", "required": false, "description": 
"Controls whether to pool (reuse) exchanges or create new exchanges 
(prototype). Using pooled will reduce JVM garbage collection overhead by 
avoiding to re-create Exchange instances per message each consumer receives. 
The default is prototype mode.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "enum", 
"javaType": "java.lang.String", "defaultValue": "default", "secret": false, " 
[...]
+    { "name": "camel.main.exchangeFactoryCapacity", "required": false, 
"description": "The capacity the pool (for each consumer) uses for storing 
exchanges. The default capacity is 100.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 100, "secret": false, "deprecated": true },
+    { "name": "camel.main.exchangeFactoryStatisticsEnabled", "required": 
false, "description": "Configures whether statistics is enabled on exchange 
factory.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": false, "secret": false, "deprecated": 
true },
     { "name": "camel.main.extraShutdownTimeout", "required": false, 
"description": "Extra timeout in seconds to graceful shutdown Camel. When Camel 
is shutting down then Camel first shutdown all the routes (shutdownTimeout). 
Then additional services is shutdown (extraShutdownTimeout).", "sourceType": 
"org.apache.camel.main.MainConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 15, "secret": false },
     { "name": "camel.main.fileConfigurations", "required": false, 
"description": "Directory to load additional properties files that contains 
configurations that takes precedence (except for camel.main.xxx 
configurations). This can be used to refer to files that may have secret 
configuration that has been mounted on the file system for containers. You can 
specify a pattern to load from file-system (not classpath) and a name pattern 
such as \/var\/app\/secret\/.properties, multiple direct [...]
     { "name": "camel.main.globalOptions", "required": false, "description": 
"Sets global options that can be referenced in the camel context Important: 
This has nothing to do with property placeholders, and is just a plain set of 
key\/value pairs which are used to configure global options on CamelContext, 
such as a maximum debug logging length etc.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "object", 
"javaType": "java.util.Map", "secret": false },
diff --git a/core/camel-api/src/main/java/org/apache/camel/PooledExchange.java 
b/core/camel-api/src/main/java/org/apache/camel/PooledExchange.java
index 5c43fe2aa5c5..8dcc411430b2 100644
--- a/core/camel-api/src/main/java/org/apache/camel/PooledExchange.java
+++ b/core/camel-api/src/main/java/org/apache/camel/PooledExchange.java
@@ -23,8 +23,10 @@ import org.apache.camel.spi.ExchangeFactory;
  * internally by Camel for optimizing memory footprint by reusing exchanges 
created by {@link Consumer}s via
  * {@link ExchangeFactory}.
  *
- * @since 3.9
+ * @since      3.9
+ * @deprecated Exchange pooling is deprecated and will be removed in a future 
release.
  */
+@Deprecated(since = "4.23.0")
 public interface PooledExchange extends Exchange {
 
     /**
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelInternalPooledTaskFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelInternalPooledTaskFactory.java
index faace274a70b..96cac3c9fed6 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelInternalPooledTaskFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelInternalPooledTaskFactory.java
@@ -20,7 +20,10 @@ import org.apache.camel.support.PooledObjectFactorySupport;
 
 /**
  * A pool for reusing {@link CamelInternalTask} to reduce object allocations.
+ *
+ * @deprecated Exchange pooling is deprecated and will be removed in a future 
release.
  */
+@Deprecated(since = "4.23.0")
 final class CamelInternalPooledTaskFactory extends 
PooledObjectFactorySupport<CamelInternalTask> {
 
     @Override
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledExchangeFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledExchangeFactory.java
index 24392c5f280b..7cb87af1592e 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledExchangeFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledExchangeFactory.java
@@ -28,7 +28,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Pooled {@link ExchangeFactory} that reuses {@link Exchange} instance from a 
pool.
+ *
+ * @deprecated Exchange pooling is deprecated and will be removed in a future 
release.
  */
+@Deprecated(since = "4.23.0")
 public final class PooledExchangeFactory extends PrototypeExchangeFactory {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(PooledExchangeFactory.class);
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledProcessorExchangeFactory.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledProcessorExchangeFactory.java
index 212acf625015..17c1511faf8f 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledProcessorExchangeFactory.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/PooledProcessorExchangeFactory.java
@@ -31,7 +31,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Pooled {@link org.apache.camel.spi.ProcessorExchangeFactory} that reuses 
{@link Exchange} instance from a pool.
+ *
+ * @deprecated Exchange pooling is deprecated and will be removed in a future 
release.
  */
+@Deprecated(since = "4.23.0")
 public class PooledProcessorExchangeFactory extends 
PrototypeProcessorExchangeFactory {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(PooledProcessorExchangeFactory.class);
diff --git 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledExchangeTask.java
 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledExchangeTask.java
index d4e02261501d..ea1cb316b337 100644
--- 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledExchangeTask.java
+++ 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledExchangeTask.java
@@ -22,8 +22,10 @@ import org.apache.camel.Exchange;
 /**
  * A task that EIPs and internal routing engine uses to store state when 
processing an {@link Exchange}.
  *
- * @see org.apache.camel.processor.PooledExchangeTaskFactory
+ * @see        org.apache.camel.processor.PooledExchangeTaskFactory
+ * @deprecated since 4.23.0 - Exchange pooling is deprecated and will be 
removed in a future release.
  */
+@Deprecated(since = "4.23.0")
 public interface PooledExchangeTask extends Runnable {
 
     /**
diff --git 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledExchangeTaskFactory.java
 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledExchangeTaskFactory.java
index b90e9f5d3df8..0dc38b9f6490 100644
--- 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledExchangeTaskFactory.java
+++ 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledExchangeTaskFactory.java
@@ -23,8 +23,10 @@ import org.apache.camel.spi.PooledObjectFactory;
 /**
  * Factory to create {@link PooledExchangeTask}.
  *
- * @see PooledExchangeTask
+ * @see        PooledExchangeTask
+ * @deprecated Exchange pooling is deprecated and will be removed in a future 
release.
  */
+@Deprecated(since = "4.23.0")
 public interface PooledExchangeTaskFactory extends 
PooledObjectFactory<PooledExchangeTask> {
 
     /**
diff --git 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledTaskFactory.java
 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledTaskFactory.java
index 30cfd2faa61d..982072b70ed2 100644
--- 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledTaskFactory.java
+++ 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/PooledTaskFactory.java
@@ -20,6 +20,10 @@ import org.apache.camel.AsyncCallback;
 import org.apache.camel.Exchange;
 import org.apache.camel.support.PooledObjectFactorySupport;
 
+/**
+ * @deprecated Exchange pooling is deprecated and will be removed in a future 
release.
+ */
+@Deprecated(since = "4.23.0")
 public abstract class PooledTaskFactory extends 
PooledObjectFactorySupport<PooledExchangeTask>
         implements PooledExchangeTaskFactory {
 
diff --git 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index 561978a50e29..8d59e0dc9e73 100644
--- 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -79,9 +79,9 @@
     { "name": "camel.main.endpointBridgeErrorHandler", "required": false, 
"description": "Allows for bridging the consumer to the Camel routing Error 
Handler, which mean any exceptions occurred while the consumer is trying to 
pickup incoming messages, or the likes, will now be processed as a message and 
handled by the routing Error Handler. By default the consumer will use the 
org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be 
logged at WARN\/ERROR level and igno [...]
     { "name": "camel.main.endpointLazyStartProducer", "required": 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 [...]
     { "name": "camel.main.endpointRuntimeStatisticsEnabled", "required": 
false, "description": "Sets whether endpoint runtime statistics is enabled 
(gathers runtime usage of each incoming and outgoing endpoints). The default 
value is false.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": false, "secret": false },
-    { "name": "camel.main.exchangeFactory", "required": false, "description": 
"Controls whether to pool (reuse) exchanges or create new exchanges 
(prototype). Using pooled will reduce JVM garbage collection overhead by 
avoiding to re-create Exchange instances per message each consumer receives. 
The default is prototype mode.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "enum", 
"javaType": "java.lang.String", "defaultValue": "default", "secret": false, " 
[...]
-    { "name": "camel.main.exchangeFactoryCapacity", "required": false, 
"description": "The capacity the pool (for each consumer) uses for storing 
exchanges. The default capacity is 100.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 100, "secret": false },
-    { "name": "camel.main.exchangeFactoryStatisticsEnabled", "required": 
false, "description": "Configures whether statistics is enabled on exchange 
factory.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": false, "secret": false },
+    { "name": "camel.main.exchangeFactory", "required": false, "description": 
"Controls whether to pool (reuse) exchanges or create new exchanges 
(prototype). Using pooled will reduce JVM garbage collection overhead by 
avoiding to re-create Exchange instances per message each consumer receives. 
The default is prototype mode.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "enum", 
"javaType": "java.lang.String", "defaultValue": "default", "secret": false, " 
[...]
+    { "name": "camel.main.exchangeFactoryCapacity", "required": false, 
"description": "The capacity the pool (for each consumer) uses for storing 
exchanges. The default capacity is 100.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 100, "secret": false, "deprecated": true },
+    { "name": "camel.main.exchangeFactoryStatisticsEnabled", "required": 
false, "description": "Configures whether statistics is enabled on exchange 
factory.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": false, "secret": false, "deprecated": 
true },
     { "name": "camel.main.extraShutdownTimeout", "required": false, 
"description": "Extra timeout in seconds to graceful shutdown Camel. When Camel 
is shutting down then Camel first shutdown all the routes (shutdownTimeout). 
Then additional services is shutdown (extraShutdownTimeout).", "sourceType": 
"org.apache.camel.main.MainConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 15, "secret": false },
     { "name": "camel.main.fileConfigurations", "required": false, 
"description": "Directory to load additional properties files that contains 
configurations that takes precedence (except for camel.main.xxx 
configurations). This can be used to refer to files that may have secret 
configuration that has been mounted on the file system for containers. You can 
specify a pattern to load from file-system (not classpath) and a name pattern 
such as \/var\/app\/secret\/.properties, multiple direct [...]
     { "name": "camel.main.globalOptions", "required": false, "description": 
"Sets global options that can be referenced in the camel context Important: 
This has nothing to do with property placeholders, and is just a plain set of 
key\/value pairs which are used to configure global options on CamelContext, 
such as a maximum debug logging length etc.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "object", 
"javaType": "java.util.Map", "secret": false },
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
index 1021e1789ba4..0d8ba777f58e 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
@@ -166,6 +166,8 @@ public final class DefaultConfigurationConfigurer {
         beanIntrospection.afterPropertiesConfigured(camelContext);
 
         if ("pooled".equals(config.getExchangeFactory())) {
+            LOG.warn(
+                    "Exchange pooling (exchangeFactory=pooled) is deprecated 
and will be removed in a future release. Please remove the 
'camel.main.exchange-factory=pooled' configuration.");
             ecc.setExchangeFactory(new PooledExchangeFactory());
             ecc.setProcessorExchangeFactory(new 
PooledProcessorExchangeFactory());
         } else if ("prototype".equals(config.getExchangeFactory())) {
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
index 1cd03a600c5b..8314b51c95ab 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
@@ -145,9 +145,12 @@ public abstract class DefaultConfigurationProperties<T> {
     private String groovyScriptPattern = 
"classpath:camel-groovy/*,classpath:camel-groovy-compiled/*";
     @Metadata(label = "advanced")
     private boolean groovyPreloadCompiled;
+    @Deprecated(since = "4.23.0")
     @Metadata(defaultValue = "default", enums = "default,prototype,pooled")
     private String exchangeFactory = "default";
+    @Deprecated(since = "4.23.0")
     private int exchangeFactoryCapacity = 100;
+    @Deprecated(since = "4.23.0")
     private boolean exchangeFactoryStatisticsEnabled;
     @Metadata(enums = "xml,yaml,json,png")
     private String dumpRoutes;
@@ -1539,6 +1542,10 @@ public abstract class DefaultConfigurationProperties<T> {
         this.groovyPreloadCompiled = groovyPreloadCompiled;
     }
 
+    /**
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
+     */
+    @Deprecated(since = "4.23.0")
     public String getExchangeFactory() {
         return exchangeFactory;
     }
@@ -1547,32 +1554,48 @@ public abstract class DefaultConfigurationProperties<T> 
{
      * Controls whether to pool (reuse) exchanges or create new exchanges 
(prototype). Using pooled will reduce JVM
      * garbage collection overhead by avoiding to re-create Exchange instances 
per message each consumer receives. The
      * default is prototype mode.
+     *
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
      */
+    @Deprecated(since = "4.23.0")
     public void setExchangeFactory(String exchangeFactory) {
         this.exchangeFactory = exchangeFactory;
     }
 
     /**
      * The capacity the pool (for each consumer) uses for storing exchanges. 
The default capacity is 100.
+     *
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
      */
+    @Deprecated(since = "4.23.0")
     public int getExchangeFactoryCapacity() {
         return exchangeFactoryCapacity;
     }
 
     /**
      * The capacity the pool (for each consumer) uses for storing exchanges. 
The default capacity is 100.
+     *
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
      */
+    @Deprecated(since = "4.23.0")
     public void setExchangeFactoryCapacity(int exchangeFactoryCapacity) {
         this.exchangeFactoryCapacity = exchangeFactoryCapacity;
     }
 
+    /**
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
+     */
+    @Deprecated(since = "4.23.0")
     public boolean isExchangeFactoryStatisticsEnabled() {
         return exchangeFactoryStatisticsEnabled;
     }
 
     /**
      * Configures whether statistics is enabled on exchange factory.
+     *
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
      */
+    @Deprecated(since = "4.23.0")
     public void setExchangeFactoryStatisticsEnabled(boolean 
exchangeFactoryStatisticsEnabled) {
         this.exchangeFactoryStatisticsEnabled = 
exchangeFactoryStatisticsEnabled;
     }
@@ -2813,7 +2836,10 @@ public abstract class DefaultConfigurationProperties<T> {
     /**
      * Controls whether to pool (reuse) exchanges or create new fresh 
exchanges (default). Using pooled will reduce JVM
      * garbage collection overhead by avoiding to re-create Exchange instances 
per message each consumer receives.
+     *
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
      */
+    @Deprecated(since = "4.23.0")
     public T withExchangeFactory(String exchangeFactory) {
         this.exchangeFactory = exchangeFactory;
         return (T) this;
@@ -2821,7 +2847,10 @@ public abstract class DefaultConfigurationProperties<T> {
 
     /**
      * The capacity the pool (for each consumer) uses for storing exchanges. 
The default capacity is 100.
+     *
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
      */
+    @Deprecated(since = "4.23.0")
     public T withExchangeFactoryCapacity(int exchangeFactoryCapacity) {
         this.exchangeFactoryCapacity = exchangeFactoryCapacity;
         return (T) this;
@@ -2829,7 +2858,10 @@ public abstract class DefaultConfigurationProperties<T> {
 
     /**
      * Configures whether statistics is enabled on exchange factory.
+     *
+     * @deprecated Exchange pooling is deprecated and will be removed in a 
future release.
      */
+    @Deprecated(since = "4.23.0")
     public T withExchangeFactoryStatisticsEnabled(boolean 
exchangeFactoryStatisticsEnabled) {
         this.exchangeFactoryStatisticsEnabled = 
exchangeFactoryStatisticsEnabled;
         return (T) this;
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultPooledExchange.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultPooledExchange.java
index 89fb75996920..37e783558ae9 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultPooledExchange.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultPooledExchange.java
@@ -26,7 +26,10 @@ import org.apache.camel.clock.Clock;
 
 /**
  * The default and only implementation of {@link PooledExchange}.
+ *
+ * @deprecated Exchange pooling is deprecated and will be removed in a future 
release.
  */
+@Deprecated(since = "4.23.0")
 public final class DefaultPooledExchange extends AbstractExchange implements 
PooledExchange {
     private final ResetableClock clock;
     private OnDoneTask onDone;
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 2bfd5cddf262..13789c47d61b 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
@@ -13,6 +13,30 @@ See the xref:camel-upgrade-recipes-tool.adoc[documentation] 
page for details.
 
 == Upgrading Camel 4.22 to 4.23
 
+=== camel-core - Exchange Pooling deprecated
+
+Exchange pooling (`exchangeFactory=pooled`) is deprecated and will be removed 
in a future release.
+The following classes are deprecated:
+
+- `org.apache.camel.PooledExchange`
+- `org.apache.camel.support.DefaultPooledExchange`
+- `org.apache.camel.impl.engine.PooledExchangeFactory`
+- `org.apache.camel.impl.engine.PooledProcessorExchangeFactory`
+- `org.apache.camel.processor.PooledExchangeTask`
+- `org.apache.camel.processor.PooledExchangeTaskFactory`
+- `org.apache.camel.processor.PooledTaskFactory`
+- `org.apache.camel.impl.engine.CamelInternalPooledTaskFactory`
+
+The following `camel.main` configuration properties are deprecated:
+
+- `camel.main.exchange-factory` (value `pooled`)
+- `camel.main.exchange-factory-capacity`
+- `camel.main.exchange-factory-statistics-enabled`
+
+To migrate, remove the `camel.main.exchange-factory=pooled` property (and any 
related capacity/statistics
+properties) from your `application.properties`. Camel will use the default 
prototype mode which creates a
+new exchange per message. A `WARN` is logged at startup if pooled mode is 
still configured.
+
 === camel-oauth
 
 OAuth client credentials token caching now distinguishes profiles by client 
secret and requested scope, in addition to token endpoint and client ID. 
Profiles with different credentials or scopes request separate tokens instead 
of reusing the same cached token. Applications using such profiles may make 
additional token requests after upgrading.
diff --git a/docs/user-manual/modules/ROOT/pages/exchange-pooling.adoc 
b/docs/user-manual/modules/ROOT/pages/exchange-pooling.adoc
index ea51101c87d1..b12c22ac1c3e 100644
--- a/docs/user-manual/modules/ROOT/pages/exchange-pooling.adoc
+++ b/docs/user-manual/modules/ROOT/pages/exchange-pooling.adoc
@@ -1,5 +1,8 @@
 = Exchange Pooling
 
+CAUTION: Exchange pooling is *deprecated* since Camel 4.23 and will be removed 
in a future release.
+Please remove any `camel.main.exchange-factory=pooled` configuration from your 
application.
+
 The routing engine keeps the state of each message, tracking the message flow, 
and where the messages are going next. The routing engine also handles complex 
tasks such as error handling, capturing metrics, and many other things. A small 
number of Java objects are allocated on the heap for each processing step 
during routing.
 
 Because of this routing bookkeeping and processing, Apache Camel requires a 
tiny resource overhead when routing messages.

Reply via email to