You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Fladnag <fl...@zerezo.com> on 2013/03/15 11:09:29 UTC

Multi CamelContext : getComponent called in configure() break some initialization

Hi,

I have a strange behavior when I call CamelContext.getComponent() on
RouteBuilder.configure() method in a blueprint bundle with 2 camel context :
*camel:list-contexts* list only one context

I also don't understand why component are linked to a Camel Context.
With 2 camel context, "shared" components are registered with the last Camel
Context.



Blueprint file with 2 camel context :


MultiCamelContextGetComponent.java :


/Without the call of *getComponent*()/ :
A) The 2 contexts are visible in karaf :


B) The 2 component (amq, amq2) are registered in ctx2 :


This can also be seen in JMX Console at org.apache.camel ->
computer_name/ctx1 -> components

/With the call of *getComponent*()/ (adding simple file bug.camel.cfg with
active.bug=true in etc folder and reload bundle):
A) Only one context is visible in karaf :


B) The 2 components (amq, amq2) are registered in ctx1 on context load and
then in ctx2 :


C) The JMX console was strange :
- On ctx1, we found amq & amq2, but with CamelId = ctx2
- On ctx2, we have no components !

D) In Karaf, ctx2 have the 2 components :


And the best for the end : in each case routes of ctx1 and ctx2 seems to
work !

Can I safely use more than one CamelContext in one Bundle ?

I have seen http://camel.apache.org/why-use-multiple-camelcontext.html where
they said to avoid that, but my application (SMX3/Camel 2.2.4, I'm trying to
migrate to SMX4) have ~50 CamelContext (SU) but only 9 SA, and I don't want
to have more than 50 bundles...

The complete maven project is attached (3 files, 3Ko) :  bug.camel.rar
<http://camel.465427.n5.nabble.com/file/n5729235/bug.camel.rar>  



--
View this message in context: http://camel.465427.n5.nabble.com/Multi-CamelContext-getComponent-called-in-configure-break-some-initialization-tp5729235.html
Sent from the Camel - Users mailing list archive at Nabble.com.