1
votes

I'm looking for a best practise how to monitor the functionality of camel routes. I know there are monitoring tools like hawtio and camelwatch, but that's not exactly what I'm looking for.

I want to know if a route is "working" as aspected, for example you have a route which listens on a queue(from("jms...")). Maybe there are messages in the queue, but the listener is not able to dequeue them because of some db issues or something else(depends on the jms provider). With the monitoring tools mentioned above you just see inflight/failed/completed messages but you don't see if the listener is able to get the messages -> so the route is not "working".

I know there is also apache BAM, maybe I have to do some more research, but somehow it looks like BAM creates new routes and you can't monitor existing routes. I also don't want to implement/define such business cases for each route, I look for a more generic way. It's also mentioned on the camel 3.0 idea board that BAM wasn't touched for 5 years, so I think people don't use it that often(which means for me it doesn't fit their needs exactly).

1

1 Answers

1
votes

I had similar requirement some time ago and at the end I developed a small Camel application for monitoring.

It run on timer, query different Camel applications installed in remote servers through JMX/Jolokia and if LastExchangeCompletedTimestamp of the route I am interested in is older than some time interval, send a mail to administrators.

Maybe this approach is too simple for your scenario, but could be an option.

(Edit: more details added)

Principal points:

Main routes queries DB for entities to control and spawns controlling routes

Controlling routes fires on quartz and http post the following url

.to("http://server:port/app/jolokia/?"+
"maxDepth=7&maxCollectionSize=500&ignoreErrors=true&canonicalNaming=false")

sending the following jsonRequest body

LinkedHashMap<String,Object> request=new LinkedHashMap<String,Object>();
request.put("type","read");
request.put("mbean","org.apache.camel:"+entity.getRouteId());
jsonRequest=mapper.writeValueAsString(request);

As response you get another JSON, parse it and get LastExchangeCompletedTimestamp value