You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/05/27 19:13:48 UTC

(camel) branch CAMEL-23615-error-registry-disable-ttl-default created (now 81899344b779)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch CAMEL-23615-error-registry-disable-ttl-default
in repository https://gitbox.apache.org/repos/asf/camel.git


      at 81899344b779 CAMEL-23615: ErrorRegistry - disable TTL by default

This branch includes the following new commits:

     new 81899344b779 CAMEL-23615: ErrorRegistry - disable TTL by default

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel) 01/01: CAMEL-23615: ErrorRegistry - disable TTL by default

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-23615-error-registry-disable-ttl-default
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 81899344b779d5f86b11e5222ee695369e7cee0d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed May 27 21:13:34 2026 +0200

    CAMEL-23615: ErrorRegistry - disable TTL by default
    
    The error registry now keeps entries based only on the maximum entries
    limit (100) without time-based eviction. The TTL default is changed
    from 1 hour to 0 (disabled). Users can still enable TTL by setting
    camel.errorRegistry.timeToLiveSeconds to a positive value.
    
    Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
 .../main/camel-main-configuration-metadata.json        |  2 +-
 .../main/java/org/apache/camel/spi/ErrorRegistry.java  |  2 +-
 .../apache/camel/impl/engine/DefaultErrorRegistry.java | 18 ++++++++++--------
 .../META-INF/camel-main-configuration-metadata.json    |  2 +-
 core/camel-main/src/main/docs/main.adoc                |  2 +-
 .../main/ErrorRegistryConfigurationProperties.java     |  7 ++++---
 .../user-manual/modules/ROOT/pages/error-registry.adoc |  2 +-
 7 files changed, 19 insertions(+), 16 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 8699514fd905..d6b0d568ec6e 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
@@ -182,7 +182,7 @@
     { "name": "camel.errorRegistry.includeExchangeProperties", "required": false, "description": "Whether to include the exchange properties in the captured error data.", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true, "secret": false },
     { "name": "camel.errorRegistry.includeExchangeVariables", "required": false, "description": "Whether to include the exchange variables in the captured error data.", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true, "secret": false },
     { "name": "camel.errorRegistry.maximumEntries", "required": false, "description": "The maximum number of error entries to keep in the registry. When the limit is exceeded, the oldest entries are evicted.", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 100, "secret": false },
-    { "name": "camel.errorRegistry.timeToLiveSeconds", "required": false, "description": "The time-to-live in seconds for error entries. Entries older than this are evicted.", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 3600, "secret": false },
+    { "name": "camel.errorRegistry.timeToLiveSeconds", "required": false, "description": "The time-to-live in seconds for error entries. Entries older than this are evicted. The default value is 0 (disabled).", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 0, "secret": false },
     { "name": "camel.faulttolerance.bulkheadEnabled", "required": false, "description": "Whether bulkhead is enabled or not on the circuit breaker. Default is false.", "sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties", "type": "boolean", "javaType": "java.lang.Boolean", "defaultValue": false, "secret": false },
     { "name": "camel.faulttolerance.bulkheadMaxConcurrentCalls", "required": false, "description": "Configures the max amount of concurrent calls the bulkhead will support. Default value is 10.", "sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties", "type": "integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false },
     { "name": "camel.faulttolerance.bulkheadWaitingTaskQueue", "required": false, "description": "Configures the task queue size for holding waiting tasks to be processed by the bulkhead. Default value is 10.", "sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties", "type": "integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false },
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ErrorRegistry.java b/core/camel-api/src/main/java/org/apache/camel/spi/ErrorRegistry.java
index 4dc302572f90..b95810777e6c 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/ErrorRegistry.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/ErrorRegistry.java
@@ -82,7 +82,7 @@ public interface ErrorRegistry extends ErrorRegistryView, StaticService {
     /**
      * Sets the time-to-live for error entries. Entries older than this duration are evicted.
      * <p/>
-     * The default value is 1 hour.
+     * The default value is 0 (disabled). Set to a positive duration to enable time-based eviction.
      */
     void setTimeToLive(Duration timeToLive);
 
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultErrorRegistry.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultErrorRegistry.java
index 50397280a8a3..2f72fd4b661f 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultErrorRegistry.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultErrorRegistry.java
@@ -50,7 +50,7 @@ public class DefaultErrorRegistry extends EventNotifierSupport implements ErrorR
     private final AtomicLong uidCounter = new AtomicLong();
     private volatile boolean enabled;
     private volatile int maximumEntries = 100;
-    private volatile Duration timeToLive = Duration.ofHours(1);
+    private volatile Duration timeToLive = Duration.ZERO;
     private volatile int bodyMaxChars = 32 * 1024;
     private volatile boolean bodyIncludeStreams;
     private volatile boolean bodyIncludeFiles = true;
@@ -224,13 +224,15 @@ public class DefaultErrorRegistry extends EventNotifierSupport implements ErrorR
         while (entries.size() > maximumEntries) {
             entries.pollLast();
         }
-        Instant cutoff = Instant.now().minus(timeToLive);
-        while (!entries.isEmpty()) {
-            BacklogErrorEventMessage last = entries.peekLast();
-            if (last != null && Instant.ofEpochMilli(last.getTimestamp()).isBefore(cutoff)) {
-                entries.pollLast();
-            } else {
-                break;
+        if (!timeToLive.isZero() && !timeToLive.isNegative()) {
+            Instant cutoff = Instant.now().minus(timeToLive);
+            while (!entries.isEmpty()) {
+                BacklogErrorEventMessage last = entries.peekLast();
+                if (last != null && Instant.ofEpochMilli(last.getTimestamp()).isBefore(cutoff)) {
+                    entries.pollLast();
+                } else {
+                    break;
+                }
             }
         }
     }
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 8699514fd905..d6b0d568ec6e 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
@@ -182,7 +182,7 @@
     { "name": "camel.errorRegistry.includeExchangeProperties", "required": false, "description": "Whether to include the exchange properties in the captured error data.", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true, "secret": false },
     { "name": "camel.errorRegistry.includeExchangeVariables", "required": false, "description": "Whether to include the exchange variables in the captured error data.", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true, "secret": false },
     { "name": "camel.errorRegistry.maximumEntries", "required": false, "description": "The maximum number of error entries to keep in the registry. When the limit is exceeded, the oldest entries are evicted.", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 100, "secret": false },
-    { "name": "camel.errorRegistry.timeToLiveSeconds", "required": false, "description": "The time-to-live in seconds for error entries. Entries older than this are evicted.", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 3600, "secret": false },
+    { "name": "camel.errorRegistry.timeToLiveSeconds", "required": false, "description": "The time-to-live in seconds for error entries. Entries older than this are evicted. The default value is 0 (disabled).", "sourceType": "org.apache.camel.main.ErrorRegistryConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 0, "secret": false },
     { "name": "camel.faulttolerance.bulkheadEnabled", "required": false, "description": "Whether bulkhead is enabled or not on the circuit breaker. Default is false.", "sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties", "type": "boolean", "javaType": "java.lang.Boolean", "defaultValue": false, "secret": false },
     { "name": "camel.faulttolerance.bulkheadMaxConcurrentCalls", "required": false, "description": "Configures the max amount of concurrent calls the bulkhead will support. Default value is 10.", "sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties", "type": "integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false },
     { "name": "camel.faulttolerance.bulkheadWaitingTaskQueue", "required": false, "description": "Configures the task queue size for holding waiting tasks to be processed by the bulkhead. Default value is 10.", "sourceType": "org.apache.camel.main.FaultToleranceConfigurationProperties", "type": "integer", "javaType": "java.lang.Integer", "defaultValue": 10, "secret": false },
diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc
index 30f68a3321a1..bb0f3a92f623 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -731,7 +731,7 @@ The camel.errorRegistry supports 8 options, which are listed below.
 | *camel.errorRegistry.includeExchangeProperties* | Whether to include the exchange properties in the captured error data. | true | boolean
 | *camel.errorRegistry.includeExchangeVariables* | Whether to include the exchange variables in the captured error data. | true | boolean
 | *camel.errorRegistry.maximumEntries* | The maximum number of error entries to keep in the registry. When the limit is exceeded, the oldest entries are evicted. | 100 | int
-| *camel.errorRegistry.timeToLiveSeconds* | The time-to-live in seconds for error entries. Entries older than this are evicted. | 3600 | int
+| *camel.errorRegistry.timeToLiveSeconds* | The time-to-live in seconds for error entries. Entries older than this are evicted. The default value is 0 (disabled). | 0 | int
 |===
 // main options: END
 
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/ErrorRegistryConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/ErrorRegistryConfigurationProperties.java
index aa7dd909d7d3..86dde828527b 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/ErrorRegistryConfigurationProperties.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/ErrorRegistryConfigurationProperties.java
@@ -32,8 +32,8 @@ public class ErrorRegistryConfigurationProperties implements BootstrapCloseable
     private boolean enabled;
     @Metadata(defaultValue = "100")
     private int maximumEntries = 100;
-    @Metadata(defaultValue = "3600")
-    private int timeToLiveSeconds = 3600;
+    @Metadata(defaultValue = "0")
+    private int timeToLiveSeconds;
     @Metadata(label = "advanced", defaultValue = "32768")
     private int bodyMaxChars = 32 * 1024;
     @Metadata
@@ -86,7 +86,8 @@ public class ErrorRegistryConfigurationProperties implements BootstrapCloseable
     }
 
     /**
-     * The time-to-live in seconds for error entries. Entries older than this are evicted.
+     * The time-to-live in seconds for error entries. Entries older than this are evicted. The default value is 0
+     * (disabled).
      */
     public void setTimeToLiveSeconds(int timeToLiveSeconds) {
         this.timeToLiveSeconds = timeToLiveSeconds;
diff --git a/docs/user-manual/modules/ROOT/pages/error-registry.adoc b/docs/user-manual/modules/ROOT/pages/error-registry.adoc
index 06392008178b..354e7d00507b 100644
--- a/docs/user-manual/modules/ROOT/pages/error-registry.adoc
+++ b/docs/user-manual/modules/ROOT/pages/error-registry.adoc
@@ -30,7 +30,7 @@ camel.errorRegistry.enabled = true
 | Option | Default | Type | Description
 | `camel.errorRegistry.enabled` | `false` | boolean | Whether the error registry is enabled.
 | `camel.errorRegistry.maximumEntries` | `100` | int | Maximum number of error entries to keep. When exceeded, the oldest entries are evicted.
-| `camel.errorRegistry.timeToLiveSeconds` | `3600` | int | Time-to-live for error entries in seconds. Entries older than this are evicted.
+| `camel.errorRegistry.timeToLiveSeconds` | `0` | int | Time-to-live for error entries in seconds. Entries older than this are evicted. The default value is 0 (disabled).
 | `camel.errorRegistry.bodyMaxChars` | `32768` | int | Maximum number of characters for the message body in the snapshot.
 | `camel.errorRegistry.bodyIncludeStreams` | `false` | boolean | Whether to include stream-based message bodies.
 | `camel.errorRegistry.bodyIncludeFiles` | `true` | boolean | Whether to include file-based message bodies.