apache-camel

Finding elapsed time in nested Camel routes


I am using Camel event notifier to calculate the time taken for a message to go through a camel route but I am little concerned about the nested routes - for example: I have these routes

from ("amq:q1").process(someProcRef).to("direct-vm:some_other_endpoint").process(oneMoreProfRef).

from("direct-vm:some_other_endpoint").process(anotherProcRef)

I am getting two exchange completed events for obvious reasons; one for first route and another one for the second route; am finding the elapsed time at each route by subtracting the current time - exchange.CREATED_TIMESTAMP but my doubt is that time elapsed for the second route may have well been included in the 1st route itself. Am I correct?


Solution

  • Yes the elapsed time is the total time the node took to process the message, even if that means the node called a sub route. So when you use direct-vm then the elapsed time includes all the time it takes to route the message by that sub route.