camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reuben Garrett <>
Subject Re: Add property to Route (not Exchange)
Date Fri, 06 Apr 2012 16:55:37 GMT

i can think of two approaches which might help:

whenever possible, i try to map my routing logic onto declarative
orchestrations of Enterprise Integration Patterns [1] to avoid interacting
directly with Camel's API [2], neutral though it may be.  perhaps your
use-case can be satisfied by factoring out common elements into sub-routes
(addressable through SEDA [3] input/outputs), and refactoring any dynamism
into (e.g.) Dynamic Routers [4] and Processors [5].  sometimes the
abstractness of this task can be challenging, but the semantics of the EIPs
are likely to be even more stable than the Camel APIs.  it's also more fun
to not have to perform garbage collection yourself.

another option is the work-around you mentioned - store the properties
somewhere else, keyed on the ID of the route.  when you need the properties
of the Route, you'd just look them up by the Route's ID (which you do
have).  sort of like Claim Check [6], albeit simpler.  if the properties'
value domains are simple enough, they could even be encoded directly in the
Route ID.


~ Reuben

On Wed, Apr 4, 2012 at 14:53, Jeff Segal <> wrote:

> Sure. I have a system which manages Routes dynamically, which requires
> some garbage collection to iterate through all Routes in the CamelContext
> and remove any which are deemed no longer necessary. For the sake of
> discussion, let's say that I wanted to associate a "color" property with
> all Routes built by a particular RouteBuilder. Later on, I want the garbage
> collection algorithm to remove "red" Routes after running for 30 minutes
> and leave other Routes alone.
> The easiest way to accomplish that would be to call a method from the
> RouteBuilder which adds a "color" property to each Route it creates, which
> I'd then inspect later on. However, the only method I have available to me
> is RouteDefinition.setProperty(), which sets properties on the Exchanges
> created by the Route, not on the Route itself.
> My current work-around is to maintain my own Route-Properties mapping in
> memory.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message