Hi Cameleers,

I'm wondering what the best way is to manage and monitor a group of routes
as an integration ('a unit of work')?
Through the mailing list, I try to gather some ideas on this topic.


Background: Integration vs Routes

Say I have three routes that together form my integration:

<routes id="myRoutesGroup" xmlns="http://camel.apache.org/schema/spring";>
    <route id="myRoutesGroup-1">
        <from uri="quartz:foo?cron={{myCron}}"/>
        <log message="Start"/>
        <to uri="direct:myRoutesGroup-2"/>
    </route>
    <route id="myRoutesGroup-2">
        <from uri="direct:myRoutesGroup-2"/>
        <log message="In the middle"/>
        <to uri="direct:myRoutesGroup-3"/>
    </route>
    <route id="myRoutesGroup-3">
        <from uri="direct:myRoutesGroup-3"/>
        <log message="Finished"/>
    </route>
</routes>

So, the work processing messages is split up into three routes, but from a
high-level view it's just one integration.

>From a Camel point of view the order doesn't matter, so I can create the
same routes also like this:

<routes id="myRoutesGroup" xmlns="http://camel.apache.org/schema/spring";>
    <route id="myRoutesGroup-3">
        <from uri="direct:myRoutesGroup-3"/>
        <log message="Finished"/>
    </route>
   <route id="myRoutesGroup-2">
        <from uri="direct:myRoutesGroup-2"/>
        <log message="In the middle"/>
        <to uri="direct:myRoutesGroup-3"/>
    </route>
<route id="myRoutesGroup-1">
        <from uri="quartz:foo?cron={{myCron}}"/>
        <log message="Start"/>
        <to uri="direct:myRoutesGroup-2"/>
    </route>
</routes>

Because the order doesn't matter for Camel the integration still works the
same.
So messages start at the quartz component and then flow through the others
routes.


What I am trying to achieve:

I was wondering how to manage and monitoring such integrations (route
groups) at once. Here is some pseudo-code how I imagine it:

RoutesGroup myRoutesGroup = context.getRouteGroup("myRoutesGroup");
myRoutesGroup.suspend(); //suspends all routes in a group
myRoutesGroup.start(); //starts all routes in a group
myRoutesGroup.stop(); //stops all routes in a group
myRoutesGroup.status(); //get the status from group

Besides managing the integration I also like to monitor it as a group. For
example to get:

1. Number or Content of messages processed by a group (in and out messages)
2. Number or Content of messages processed by a single route in the group
(in and out message).

With the second, I mean messages on a route level. What message goes into a
route and what messages go out. This in contrast to exchanges, because
exchanges create events on a lower level. In this example I am using direct
component, so that would create the following exchange events:

1. First route: ExchangeCreated, some ExchangeSending/ExchangeSent events
2. Second route: Only sending/sent events
3. Third route: Sending/sent events and the completed event.

>From an integration point of view, I am only interested in what goes in and
out the integration and how many messages that are. Or I am interested
what messages are going into and out a single route (as a processing step).

Is there a way to work with integrations opposed to routes? What are the
possibilities in Camel?

Raymond

Reply via email to