Hi

Are you sure your app keep running.
The start method on spring app context is non blocking.

See these FAQs
http://camel.apache.org/running-camel-standalone.html
http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html

On Tue, Feb 19, 2013 at 11:45 AM, Marco Crivellaro
<marco.cr...@gmail.com> wrote:
> Hi All,
> I am setting up a camel context with 2 routes consuming 2 ActiveMQ queues.
> The connectionstring to the broker specifies failover protocol, however if
> the broker for some reason goes offline the context shutsdown itself
> automatically. Is there a way to keep the context trying to reconnect to
> ActiveMQ?
>
> my spring context is as following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xsi:schemaLocation="
>          http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>          http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd";>
>
>   <camelContext id="hulkcontext"
> xmlns="http://camel.apache.org/schema/spring"; autoStartup="false">
>     <package>com.crive</package>
>
>     <route>
>                 <from uri="jms:queue:crive.data"/>
>                 <to uri="bean:myDataProcessor"/>
>                 <inOut uri="mock:dataresult" />
>         </route>
>         <route>
>                 <from uri="jms:queue:crive.status"/>
>                 <to uri="bean:myStatusProcessor"/>
>                 <inOnly uri="mock:statusresult" />
>         </route>
>
>
>   </camelContext>
>
>
>   <bean id="myDataProcessor" class="com.crive.DataProcessor"/>
>   <bean id="myStatusProcessor" class="com.crive.StatusProcessor"/>
>
>
>   <bean id="jms"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>     <property name="connectionFactory">
>       <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>         <property name="brokerURL"
> value="failover://(tcp://hostname:61616)?initialReconnectDelay=100"/>
>       </bean>
>     </property>
>   </bean>
> </beans>
>
>
>
>
>
> main method is as following:
>
>         public static void main(String[] args) throws Exception {
>
>
>                 ApplicationContext appContext = new
> FileSystemXmlApplicationContext("camel-context.xml");
>                 final SpringCamelContext context = (SpringCamelContext)
> appContext.getBean("hulkcontext");
>                 context.start();
>
>                 Runtime rt = Runtime.getRuntime();
>                 rt.addShutdownHook(new Thread() {
>                         public void run() {
>                                 LOG.info("Application is being shutdown.");
>                                 try {
>                                         context.stop();
>                                 } catch (Exception e) {
>                                         LOG.error("Exception occured while 
> stopping the service", e);
>                                 }
>                         }
>                 });
>
>
>         }
>
>
>
>
>
>
> it looks like the shutdown hook is being called as in the Logs I can find
> "Application is being shutdown." but I am not calling it programmatically
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-shutsdown-route-even-when-using-failover-tp5727781.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to