Search code examples
apache-camel

Get the RouteBuilder class used at execution time


Is it possible to retrieve what RouteBuilder class was used to build a Route at execution time via the Exchange? For example;

class SimplePingRoute : RouteBuilder() {
override fun configure() {
    from("timer://foo?fixedRate=true&period=1000")
        .routeId("pong-demo-app")
        .process({exc->
            //***looking for SimplePingRoute at this point from exc*** 
        })
        .to("log:pong")
}}

Solution

  • Camel 3.20 onwards stores the source file:line-number of the routes for each EIP node (you need to enable this for Java DSL). This allows tooling such as the debugger to correlate the runtime debug session with the source code. And tooling like camel-jbang to output source precise information.

    Maybe your tool can use that also.