You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gustav Sinder <gu...@ferrologic.se> on 2015/04/15 15:37:41 UTC

Getting list of contexts or getting context by name

Hi,

I'm working on a solution where I dynamically setup/remove routes based on external configuration. So far so good, it works good, a manager route handles this just good.
A thought would be to place the dynamic routes in another context. I can create new contexts from within the Java without problem but I can't seem to find a way to either list the active contexts and/or get a context by its name.

Also, are there any drawbacks on using another CamelContext instead of placing it all in the same one where the "manager route" also runs?

Thanks
/Gustav



RE: Getting list of contexts or getting context by name

Posted by Gustav Sinder <gu...@ferrologic.se>.
Hi,

Correct, it's Camel Context I was thinking of.
Thanks, I was suspecting that the context is only aware of itself and others created from it. I'll stick with the same Context for the dynamic ones.

Regards
/Gustav



-----Original Message-----
From: Willem Jiang [mailto:willem.jiang@gmail.com] 
Sent: den 16 april 2015 03:32
To: users@camel.apache.org
Subject: Re: Getting list of contexts or getting context by name

I just assume the context means Camel Context, am I right?
If you create the Camel Context you need to manage it yourself. I don’t think it is possible to look up the other Camel Context from the route which only knows about the CamelContext holds it.
There are some components can only be used to talk each other within the same CamelContext, such as seda, direct. And we use these component to glue the routes. 

So my suggestion is you keep the dynamic routes in the same CamelContext, unless you don’t want them talk to each other. 

--
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem



On April 15, 2015 at 9:38:42 PM, Gustav Sinder (gustav.sinder@ferrologic.se) wrote:
> Hi,
>  
> I'm working on a solution where I dynamically setup/remove routes 
> based on external configuration. So far so good, it works good, a manager route handles this just good.
> A thought would be to place the dynamic routes in another context. I 
> can create new contexts from within the Java without problem but I 
> can't seem to find a way to either list the active contexts and/or get a context by its name.
>  
> Also, are there any drawbacks on using another CamelContext instead of 
> placing it all in the same one where the "manager route" also runs?
>  
> Thanks
> /Gustav
>  
>  
>  


Re: Getting list of contexts or getting context by name

Posted by Willem Jiang <wi...@gmail.com>.
I just assume the context means Camel Context, am I right?
If you create the Camel Context you need to manage it yourself. I don’t think it is possible to look up the other Camel Context from the route which only knows about the CamelContext holds it.
There are some components can only be used to talk each other within the same CamelContext, such as seda, direct. And we use these component to glue the routes. 

So my suggestion is you keep the dynamic routes in the same CamelContext, unless you don’t want them talk to each other. 

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 15, 2015 at 9:38:42 PM, Gustav Sinder (gustav.sinder@ferrologic.se) wrote:
> Hi,
>  
> I'm working on a solution where I dynamically setup/remove routes based on external  
> configuration. So far so good, it works good, a manager route handles this just good.  
> A thought would be to place the dynamic routes in another context. I can create new contexts  
> from within the Java without problem but I can't seem to find a way to either list the active  
> contexts and/or get a context by its name.
>  
> Also, are there any drawbacks on using another CamelContext instead of placing it all  
> in the same one where the "manager route" also runs?
>  
> Thanks
> /Gustav
>  
>  
>