daBigBug
daBigBug

Reputation: 353

Display all active routes in Apache Camel

I am using Apache camel to trigger various actions based on timer events. For timer events to trigger, I am using camel-quartz. And a sample trigger looks like this:

from("quartz://job_timers/customer_activation?cron=0+0+0+*+*+?+*&trigger.timeZone=America/Chicago")
                .routeId("TrigCustActivation")
                .log(LoggingLevel.INFO, "Triggered Customer Activation Job")
                .to("direct://set/headers/activation")
                .to("direct://customer/activation");

Over the period of time, the number of such triggers have increased a lot. And they will be increasing even more. So, instead of keeping a hard-copy of when which job will trigger, I was planning to create a web-route, so that when I perform a GET request, it would fetch all the active routes, and print their RouteIds (I will update all the RouteIds to have time as well. Say, the routeId for above flow will become "TrigCustActivation_00_00_CST_Daily").

I was able to print all the route at application startup, but failed to fetch those dynamically through a GET request.

Can we access other RouteIds from a running route? Is my approach feasible?

Upvotes: 1

Views: 2300

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55525

Yes there is API on CamelContext where you can fetch all the current routes, and you can then get their IDs etc. See the javadoc of this class.

Upvotes: 2

Related Questions