davsclaus opened a new pull request, #26804: URL: https://github.com/apache/camel/pull/26804
The line every Camel user reads first names the message and the exchange, and nothing else: ``` Failed delivery for (MessageId: 1A2B3C on ExchangeId: 1A2B3C). Exhausted after delivery attempt: 1 caught: java.lang.IllegalArgumentException: Forced error ``` No route, no node, no source location. To find out where it happened the reader turns to the Message History table below — which has all three. The facts are already on the exchange when that line is built. `ExchangeHelper.captureFailureOrigin` stores `FAILURE_ROUTE_ID`, `FAILURE_NODE_ID` and `FAILURE_LOCATION` on every failure, propagates them through `ShareUnitOfWorkAggregationStrategy` and clears them in `FinallyProcessor` — and `FAILURE_LOCATION` had exactly one reader in the whole code base, `DefaultErrorRegistry`. The most-read line in the log did not use it. ### After ``` Failed delivery for (MessageId: 1A2B3C on ExchangeId: 1A2B3C) at route1[to3] orders.camel.yaml:18. Exhausted after delivery attempt: 1 caught: ... ``` A YAML route gives `orders.camel.yaml:18`; a Java route gives `MyRouteBuilder:42`. All ten failure messages in `RedeliveryErrorHandler` (seven `Failed delivery for`, two `Rollback`, one `New exception`) share the `ExchangeHelper.logIds(exchange)` prefix, so they all gain it. One ordering change: `captureFailureOrigin` moves above the `On delivery attempt` message in the same block, so that message carries the origin too — it was previously built eight lines before the capture. It is still before any failure processor runs and adds its own entries to the message history, which is what the placement requires. `ExchangeHelper.logIds` itself is unchanged — it has callers outside this class, and a failure origin only means something where one was captured. Nothing is appended when the properties are absent, so the line keeps its shape. ### Testing - `FailedDeliveryOriginTest` — the message names the route, the node and the source location. It injects a recording `CamelLogger` via `deadLetterChannel(...).logger(...)`, so the assertion reads the message itself rather than a log file. - `FailedDeliveryOriginNoSourceLocationTest` — with source location off, the message names the route and node and stops there rather than inventing a line. - 573 tests across 305 classes in camel-core (`*ErrorHandler*`, `*DeadLetter*`, `*Redeliver*`, `*OnException*`, `*FailureHandled*`, `*Rollback*`) pass. Part of CAMEL-24844; sibling of CAMEL-24972 (#26802), which does the same for the error registry's step strings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
