[
https://issues.apache.org/jira/browse/CAMEL-17484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17475480#comment-17475480
]
Raymond commented on CAMEL-17484:
---------------------------------
Yes, that maybe a risk. I think of it conceptually as that
RouteTemplates/Kamelets are like reusable blocks/steps to build a flow,
similarly as steps in a route together form a route. Thus they are the same,
only they are on a higher abstraction level. So to say a flow is more like a
low-code DSL that's specific to an organization). I feel like there could be
more use for routeTemplates as there is now, they are too close to normal
route.
Just my two cents. When there is one or two ideas that can make them better it
would great. If not the ticket can be closed.
> RouteTemplates: A flexible builder
> ----------------------------------
>
> Key: CAMEL-17484
> URL: https://issues.apache.org/jira/browse/CAMEL-17484
> Project: Camel
> Issue Type: Wish
> Components: came-core
> Reporter: Raymond
> Priority: Minor
>
> I sometimes use a RouteTemplate:
> https://camel.apache.org/manual/route-template.html
> Then I create a route as follows:
> TemplatedRouteBuilder.builder(context, "myTemplate")
> .parameter("name", "one")
> .parameter("greeting", "Hello")
> .add();
>
> I am wondering if generating a route could be more flexible?
> For example to use routeTemplates as "blocks" to create one route from
> multiple routeTemplates.
> TemplatedRouteBuilder.builder(context, "myTemplate,myTemplate2")
> .parameter("name", "one")
> .parameter("greeting", "Hello")
> .add();
> Say in myTemplate is like this:
> .from("timer:\{{name}}?period=\{{myPeriod}}")
> .setBody(simple("\{{greeting}} ${body}"))
> And I have second template myTemplate2:
> .log("${body}");
> Then the resulted route would be:
> .from("timer:\{{name}}?period=\{{myPeriod}}")
> .setBody(simple("\{{greeting}} ${body}"))
> .log("${body}");
> This would make it more flexible to use a template or not, combine templates
> and so on. Thus, with 10 templates there would be all kind of configurations
> possible.
> There could also be the option to combine the templates into one route or
> with into multiple routes with endpoint between them .
> For example, direct / direct-vm / seda / vm as connecting endpoint.
> If for example, the user would choose "direct"
> TemplatedRouteBuilder.builder(context, "myTemplate,myTemplate2")
> .connectingEndpoint("direct")
> .parameter("name", "one")
> .parameter("greeting", "Hello")
> .add();
>
> then the result would be:
> .from("timer:\{{name}}?period=\{{myPeriod}}")
> .setBody(simple("\{{greeting}} ${body}"))
> .to("direct:myTemplate2")
>
> .from("direct:myTemplate2")
> .log("${body}");
> Probably some id would also be need to make the endpoints unique.
> The last idea is to use one file or an object to put all the parameters at
> once. For example by
> - file (a xml or json file with properties)
> - object (like a map, treemap or properties) -->
> https://camel.apache.org/components/3.14.x/properties-component.html
> TemplatedRouteBuilder.builder(context, "myTemplate,myTemplate2")
> .parameterFile(myJson)
> .add();
> TemplatedRouteBuilder.builder(context, "myTemplate,myTemplate2")
> .parameterMap(myMap)
> .add();
> This would be convenient with lots of parameters.
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)