On Wed, Apr 4, 2012 at 9:53 PM, Jeff Segal <jeffrey.se...@gmail.com> 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.
>

There is a LifecycleStrategy or a EventNotifier you can hook into to
get callbacks when routes is added/remove etc. This may help you keep
the map's up-to-date.


> Does this make sense?
>
> On Wed, Apr 4, 2012 at 3:15 PM, Raul Kripalani <r...@fusesource.com> wrote:
>
>> Hi Jeff,
>>
>> Could you explain your use case a bit further? It is not clear what you
>> ultimately want to achieve.
>>
>> Regards,
>> Raúl.
>>
>> On 4 April 2012 18:35, Jeff Segal <jeffrey.se...@gmail.com> wrote:
>>
>> > Is there any facility to add arbitrary properties to Routes rather than
>> > just Exchanges from within a RouteBuilder? I noticed that there are a few
>> > internally managed properties automatically added to each Route (id,
>> > parent, group) but I could not find a hook to set additional ones from a
>> > RouteBuilder.
>> >
>> > Thanks,
>> > Jeff
>> >
>>



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to