Route Templates

Route Templates and Templated Routes are standard Camel components (https://camel.apache.org/manual/route-template.html). They allow you to create a Route Template definition that consists of a route definition along with parameters. Then, the Templated Route can be deployed, enabling you to reuse the same route definition with different parameters.

For example, using this Route Template definition:

<routeTemplate id="myTemplate"> <templateParameter name="name"/> <route> <from uri="timer:{{name}}?period=1s"/> <setBody> <simple>Hello {{name}}</simple> </setBody> <log message="${body}"/> </route> </routeTemplate>

We can deploy Template Routes:

<templatedRoute routeTemplateRef="myTemplate" routeId="sampleRouteId1"> <parameter name="name" value="Foo"/> </templatedRoute> <templatedRoute routeTemplateRef="myTemplate" routeId="sampleRouteId2"> <parameter name="name" value="Bar"/> </templatedRoute>

As a result, two routes will be created in Camel context, one logging Hello Foo and the second one logging Hello Bar.

If a new Route Template is deployed, IM will detect it and redeploy all child routes spawned by changed Route Template. This allows for the reuse of route definitions, and in case of a change, redeployment will be done automatically, eliminating the need for manual changes to each deployed route.

IM also allows you to convert a Template Route into a plain route, which means it will be disconnected from its parent and it will not be redeployed when the parent changes.

On provisioned instances, both Route Templates and Templated Routes can be deployed by:

  • using IM HttpClient;

  • manually placing their definition in the repository.

When placing definitions in the repository:

  • Route Templates should be placed in /route-templates directory.

  • Templated Routes should be placed in /routes directory.

IntegrationManager version 5.8.0