[ 
https://issues.apache.org/jira/browse/CAMEL-17555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17500748#comment-17500748
 ] 

Nicolas Filotto commented on CAMEL-17555:
-----------------------------------------

The option "precondition" has been added to the route to be able to include or 
not a route according to the result of a predicate expressed in simple language 
like in the next examples:

Java DSL:
{code:java}
from("direct:in").precondition("'{{format}}' == 'xml'")
   .unmarshal().jaxb()
   .to("direct:out");{code}
XML DSL:
{code:java}
<route precondition="'{{format}}' == 'xml'">
  <from uri="direct:in"/>
  <unmarshal><jaxb/></unmarshal>
  <to uri="direct:out"/>
</route>{code}
YAML DSL:
{code:java}
- route:
    precondition: "'{{format}}' == 'xml'"
    from:
      uri: "direct:in"
      steps:
        - unmarshal:
            jaxb: {}
        - to: "direct:out"{code}
 

> camel-core - Flag to include/exclude routes in route templates
> --------------------------------------------------------------
>
>                 Key: CAMEL-17555
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17555
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Nicolas Filotto
>            Priority: Major
>             Fix For: 3.16.0
>
>
> To make route templates (aka kamelets) more flexible it can benefit that we 
> allow to declare routes whether they should be included or excluded. This 
> allows to parameterize these routes and therefore only include them if the 
> template has a parameter included for this.
> A bit like the new doSwitch which optimizes the when and only select the one 
> that has a parameter from the template.
> Now we need to come up with a good name for such an option, and should it be 
> include/exclude, filter, or pattern or enabled/disabled or something else.
> We can use simple language so you can say something like:
> <route enabled="{{protocol}} == 'avro'">
> </route>
> <route enabled="{{protocol}} == 'json'">
> </route>



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to