You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/03/06 09:40:35 UTC

[PR] CAMEL-23079: Add ErrorRegistry SPI for capturing routing errors [camel]

gnodet opened a new pull request, #21730:
URL: https://github.com/apache/camel/pull/21730

   ## Summary
   
   - Adds a new `ErrorRegistry` SPI that captures exceptions during message routing and stores immutable snapshots (`ErrorRegistryEntry`) in bounded in-memory storage
   - Uses the `EventNotifier` pattern (`ExchangeFailedEvent` / `ExchangeFailureHandledEvent`) for decoupled error capture
   - Provides route-scoped views via `ErrorRegistryView` / `forRoute(routeId)`
   - Includes JMX MBean, Dev Console, and `camel.main.errorRegistry*` configuration properties
   - Disabled by default, opt-in via `errorRegistryEnabled=true`
   
   ## Design
   
   - **`ErrorRegistry`** extends `ErrorRegistryView` and `StaticService` — the main SPI
   - **`ErrorRegistryView`** — browsing/clearing interface (also returned by `forRoute()`)
   - **`ErrorRegistryEntry`** — immutable snapshot with record-style accessors
   - `DefaultErrorRegistry` extends `EventNotifierSupport`, uses `ConcurrentLinkedDeque` with lazy eviction (capacity + TTL)
   - Configurable: max entries (default 100), TTL (default 1h), optional stack trace capture
   - Follows the `InflightRepository` architectural pattern
   
   ## Test plan
   
   - [x] 7 unit tests covering: error capture, disabled state, route-scoped views, max entries eviction, stack trace capture, browse limit, clear
   - [x] Full `mvn clean install -Dquickly` passes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23079: Add ErrorRegistry SPI for capturing routing errors [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #21730:
URL: https://github.com/apache/camel/pull/21730#discussion_r2909829962


##########
core/camel-api/src/main/java/org/apache/camel/spi/ErrorRegistryEntry.java:
##########
@@ -66,4 +66,11 @@ public interface ErrorRegistryEntry {
      * Each element represents one line of the stack trace.
      */
     String[] stackTrace();
+
+    /**
+     * The message history trace, or {@code null} if message history is not enabled.
+     * <p/>
+     * Each element represents one step in the routing history (e.g. "routeId[nodeId]").
+     */
+    String[] messageHistory();

Review Comment:
   Camel has `MessageHistory` as type. So instead of a string array with unstructured data. Then you have a List<MessageHistory> which gives you access to all data. 
   
   Also we can update the MessageHelper to have a new dumpMessageHistoryStacktrace that takes information not from an Exchange but so you can pass on details from this error registry in case you want to dump this in the same way that Camel does it.
   
   And there I can also see we need to capture - the original route id and endpoint uri that the exchange was originating from, so you know where it all started. Also the exchange id.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23079: Add ErrorRegistry SPI for capturing routing errors [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21730:
URL: https://github.com/apache/camel/pull/21730#issuecomment-4010670678

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23079: Add ErrorRegistry SPI for capturing routing errors [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #21730:
URL: https://github.com/apache/camel/pull/21730#issuecomment-4029092837

   the message history is also very useful - so if you enabled this, then the exchange contains exchange property with the trace of every node the message has been routed up until the error. This information would be great to capture as well.
   
   The console should then also include this information, see the other concole that dumps the message history.
   
   Also I think that stacktrace should enabled by default, when you use this feature. I dont think it takes up much memory and that is not a concern. Its about having as much relevant information at hand so the problem can be understood
   
   Also can TTL be disabled with -1 or something so the entries are there without expiring?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23079: Add ErrorRegistry SPI for capturing routing errors [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #21730:
URL: https://github.com/apache/camel/pull/21730


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23079: Add ErrorRegistry SPI for capturing routing errors [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #21730:
URL: https://github.com/apache/camel/pull/21730#discussion_r2909687828


##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_19.adoc:
##########
@@ -32,6 +32,28 @@ uses `InOnly` pattern.
 
 Removed 2 deprecated methods in Java DSL for `throttler` EIP.
 
+==== ErrorRegistry

Review Comment:
   This is only related to upgrade - this information is better in a new doc file that document this new feature.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23079: Add ErrorRegistry SPI for capturing routing errors [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #21730:
URL: https://github.com/apache/camel/pull/21730#issuecomment-4014095688

   rebase on main


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org