AutoGenerating routeId on a camel

In apache-camel, is there a way to automatically generate routeId, overriding existing route numbers (generated in RouteDefinitionHelper)?

+3


source to share


2 answers


As far as I know, there is no autogeneration policy on routeNaming that you can use, but you can do something similar to this:

private String myURI;

from("jms:queue:" + myURI).routeId("JmsComponent:" + myURI)
    .to("....");

      



Using something like plan or spring to inject your variable into a java class you can change your URI and it will change the route name accordingly. You can also use the full URI in your personal variable and then parse the URI endpoint yourself and format it for routeId.

+1


source


You can specify them directly for routes, as well as for processors in your routes.

from("direct:start").routeId("MyMainRoute")
    .to("direct:out").id("MyOutputProcessor");

      



These ids will be visible in your jConsole so you can see statistics on your routes and cpus.

0


source







All Articles