You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "peter_minearo@skycreek.com" <pe...@skycreek.com> on 2014/05/27 22:13:43 UTC

Camel Context shutdown by Spring Child Context

I have a couple of Questions:

I have a standalone (legacy) application that creates a Spring Parent
Context which is where the CamelContext is created. Spring Batch is, also,
created in the Parent Context.  What this application does is create a Child
Context for each of the Spring Batch Jobs when the Job executes.  Then, when
a Job is completed, it tears down the Child Context.  This inadvertently
tears down the CamelContext and stops all of the routes.  

Is there always one Instance of a Camel Context throughout ALL of the
Hierarchical Spring Contexts?
For instance, there would only be 1 Camel Context in the following scenario:
- Create Parent Context with Camel Context created
-- Create First Child Context
-- Create Second Child Context

Is there a way to tell the CamelContext to NOT shutdown while there is a
Parent Context still around? 

 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Context-shutdown-by-Spring-Child-Context-tp5751633.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Context shutdown by Spring Child Context

Posted by "peter_minearo@skycreek.com" <pe...@skycreek.com>.
After much digging around, I agree this can be tricky to get right.  Since I
am working with a legacy monolithic application, the only solution I see is
to create a separate Application Context for just Camel and the Messaging. 
This will keep it separate from the other Contexts and allow us, at some
point, to make the architecture more module at some point.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Context-shutdown-by-Spring-Child-Context-tp5751633p5751662.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Context shutdown by Spring Child Context

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, May 27, 2014 at 10:13 PM, peter_minearo@skycreek.com
<pe...@skycreek.com> wrote:
> I have a couple of Questions:
>
> I have a standalone (legacy) application that creates a Spring Parent
> Context which is where the CamelContext is created. Spring Batch is, also,
> created in the Parent Context.  What this application does is create a Child
> Context for each of the Spring Batch Jobs when the Job executes.  Then, when
> a Job is completed, it tears down the Child Context.  This inadvertently
> tears down the CamelContext and stops all of the routes.
>
> Is there always one Instance of a Camel Context throughout ALL of the
> Hierarchical Spring Contexts?
> For instance, there would only be 1 Camel Context in the following scenario:
> - Create Parent Context with Camel Context created
> -- Create First Child Context
> -- Create Second Child Context
>
> Is there a way to tell the CamelContext to NOT shutdown while there is a
> Parent Context still around?
>

I do not think so.

As this can be complicated to get correct, (make sure it keep works
for all the other users) I cannot see a good solution to this.
You are welcome to look in camel-spring and debug and see in that
spring event if there is anything of use to figure out a way to do
what you want



>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Context-shutdown-by-Spring-Child-Context-tp5751633.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/