You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "alberto.zigoni" <al...@gmail.com> on 2011/07/08 12:53:04 UTC

Multiple contexts startup order with Spring

Is it possible to define the order in which different Camel contexts should
be started, using Spring?

One solution could be to set autoStartup=false to each context and then
having a Spring context-aware bean perform the startup of the contexts in
the right order, but I am looking for an out-of-the-box solution, if
available.


--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-contexts-startup-order-with-Spring-tp4564321p4564321.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Multiple contexts startup order with Spring

Posted by "alberto.zigoni" <al...@gmail.com>.
Using "depends-on" on the camelContext does the trick, but it couples the
contexts. In my case, the first context is used only during development.

Anyway, I have just found a rather rough but working way of doing it.
My Camel contexts are defined in two different XML files under
META-INF/spring, and I have noticed that Spring sorts files before loading
them. Thus, using filenames with patterns such as e.g. 
01-camel-context.xml, 02-camel-context.xml, the contexts are loaded in the
desired order.


Hi

Spring is pretty lame in letting end users be in control of the orders.

All you have at your disposal in the XML file is the "depends-on" attribute.
So try using that to see if you can control the ordering a bit better.



--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-contexts-startup-order-with-Spring-tp4564321p4564402.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Multiple contexts startup order with Spring

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Spring is pretty lame in letting end users be in control of the orders.

All you have at your disposal in the XML file is the "depends-on" attribute.
So try using that to see if you can control the ordering a bit better.


On Fri, Jul 8, 2011 at 12:53 PM, alberto.zigoni
<al...@gmail.com> wrote:
> Is it possible to define the order in which different Camel contexts should
> be started, using Spring?
>
> One solution could be to set autoStartup=false to each context and then
> having a Spring context-aware bean perform the startup of the contexts in
> the right order, but I am looking for an out-of-the-box solution, if
> available.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Multiple-contexts-startup-order-with-Spring-tp4564321p4564321.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/