Claus Ibsen created CAMEL-25207:
-----------------------------------

             Summary: camel-yaml-dsl - Support route scoped onException, 
onCompletion and interceptors as in the XML and Java DSL
                 Key: CAMEL-25207
                 URL: https://issues.apache.org/jira/browse/CAMEL-25207
             Project: Camel
          Issue Type: Improvement
          Components: camel-yaml-dsl
            Reporter: Claus Ibsen


In the XML and Java DSL the cross-cutting EIPs can be scoped to a single route:

* Java: {{from(...).onException(...)}} and {{from(...).onCompletion()}} inside 
the route.
* XML: {{<onException>}}, {{<onCompletion>}}, {{<intercept>}}, 
{{<interceptFrom>}} and {{<interceptSendToEndpoint>}} inside a {{<route>}}.

The YAML DSL only has them at the top level (applies to all routes of the file) 
or in a {{routeConfiguration}}; the schema rejects them as route steps 
("'onException' is a top-level entry: write it as a list item at the same level 
as the route, not inside it").

The YAML routes loader does accept them as steps when the file is not 
validated, but flow mode then makes the steps after an {{onException}} with no 
steps of its own its children, so the route fails to start ("Route has no 
output processors").

This also shows in the YAML dumper ({{camel transform route --format yaml}}): 
an XML or Java route with a route scoped onException, onCompletion or 
interceptor is written as YAML that {{camel validate}} rejects. Found by the 
YAML round-trip test of CAMEL-25206 (XML corpus of camel-xml-io: 
barOnExceptionRoute.xml, onCompletion.xml, barInterceptorRoute.xml, 
interceptFrom.xml, interceptFromAndSendTo.xml).

Proposal:
* Allow onException, onCompletion, intercept, interceptFrom and 
interceptSendToEndpoint as steps of a route in the YAML DSL (schema and 
loader), route scoped like in XML.
* Exclude them from flow mode: the steps after them are never theirs 
(transacted and saga keep taking the rest of the route).
* Remove the known entries from the round-trip test of CAMEL-25206.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to