[
https://issues.apache.org/jira/browse/CAMEL-28099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-28099:
--------------------------------
Description:
h3. Problem
{{AdviceWith}} prepares the advised route again: {{merged.markUnprepared();
routes.prepareRoute(merged);}}
({{core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWith.java:274-276}}).
Preparing a route is not idempotent: the definitions merged from the route
configurations the first time are now in the route outputs and are seen as the
route's own, and the configurations are merged again.
Observed: a route with one route configuration onException has 1 onException in
the model before {{AdviceWith}} and 2 after it.
At runtime this mostly works (both are the same instance), but:
* the model, the route dumps and the route diagrams show the onException twice;
* a transacted or saga route can get duplicated steps;
* an intercept from a route configuration may be applied twice (from reading
the code, not verified);
* a RouteBuilder-level intercept does not come back, as its definition was
removed from the outputs (CAMEL-28100).
h3. Proposed fix
Prepare the advised route from the route as written, before the first merge.
CAMEL-25142 step 1 plans to keep a copy of the route as written for this, so
the two can share the code. Tests: {{AdviceWith}} on a route with a route
configuration (onException, intercept, onCompletion) merges each of them once.
Found while analysing CAMEL-25142 (late binding of cross-cutting features),
with probe tests on main (4a354d948e9c).
_Claude Code on behalf of davsclaus_
was:
h3. Problem
{{AdviceWith}} prepares the advised route again: {{merged.markUnprepared();
routes.prepareRoute(merged);}}
({{core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWith.java:274-276}}).
Preparing a route is not idempotent: the definitions merged from the route
configurations the first time are now in the route outputs and are seen as the
route's own, and the configurations are merged again.
Observed: a route with one route configuration onException has 1 onException in
the model before {{AdviceWith}} and 2 after it.
At runtime this mostly works (both are the same instance), but:
* the model, the route dumps and the route diagrams show the onException twice;
* a transacted or saga route can get duplicated steps;
* an intercept from a route configuration may be applied twice (from reading
the code, not verified);
* a RouteBuilder-level intercept does not come back, as its definition was
removed from the outputs (see the intercept ticket linked to CAMEL-25142).
h3. Proposed fix
Prepare the advised route from the route as written, before the first merge.
CAMEL-25142 step 1 plans to keep a copy of the route as written for this, so
the two can share the code. Tests: {{AdviceWith}} on a route with a route
configuration (onException, intercept, onCompletion) merges each of them once.
Found while analysing CAMEL-25142 (late binding of cross-cutting features),
with probe tests on main (4a354d948e9c).
_Claude Code on behalf of davsclaus_
> camel-core - AdviceWith merges the route configurations into the route a
> second time
> ------------------------------------------------------------------------------------
>
> Key: CAMEL-28099
> URL: https://issues.apache.org/jira/browse/CAMEL-28099
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: Claus Ibsen
> Priority: Major
> Fix For: 4.25.0
>
>
> h3. Problem
> {{AdviceWith}} prepares the advised route again: {{merged.markUnprepared();
> routes.prepareRoute(merged);}}
> ({{core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWith.java:274-276}}).
> Preparing a route is not idempotent: the definitions merged from the route
> configurations the first time are now in the route outputs and are seen as
> the route's own, and the configurations are merged again.
> Observed: a route with one route configuration onException has 1 onException
> in the model before {{AdviceWith}} and 2 after it.
> At runtime this mostly works (both are the same instance), but:
> * the model, the route dumps and the route diagrams show the onException
> twice;
> * a transacted or saga route can get duplicated steps;
> * an intercept from a route configuration may be applied twice (from reading
> the code, not verified);
> * a RouteBuilder-level intercept does not come back, as its definition was
> removed from the outputs (CAMEL-28100).
> h3. Proposed fix
> Prepare the advised route from the route as written, before the first merge.
> CAMEL-25142 step 1 plans to keep a copy of the route as written for this, so
> the two can share the code. Tests: {{AdviceWith}} on a route with a route
> configuration (onException, intercept, onCompletion) merges each of them once.
> Found while analysing CAMEL-25142 (late binding of cross-cutting features),
> with probe tests on main (4a354d948e9c).
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)