Hi

See this example which has embedded broker and camel, and how using
depends-on helps the ordering.
https://github.com/apache/camel/blob/master/examples/camel-example-management/src/main/resources/META-INF/spring/camel-context.xml

On Thu, Feb 6, 2014 at 8:10 AM, rmueller <rainer.muel...@inventage.com> wrote:
> We use ActiveMQ in standalone mode with integrated Camel.
>
> As ActiveMQ is shutting down before CamelContext we get the following WARN /
> ERROR messages in the logfile.
>
> WARN  | Setup of JMS message listener invoker failed for destination
> 'que.contactCustomer.in' - trying to recover. Cause: peer (vm://myBroker#1)
> stopped. | org.apache.camel.component.jms.DefaultJmsMessageListenerContainer
> | Camel (camel) thread #0 - JmsConsumer[que.contactCustomer.in]
>
> ERROR | Could not refresh JMS Connection for destination
> 'que.contactCustomer.in' - retrying in 5000 ms. Cause: Error while
> attempting to retrieve a connection from the pool; nested exception is
> javax.jms.JMSException: Could not create Transport. Reason:
> java.io.IOException: Broker named 'myBroker' does not exist. |
> org.apache.camel.component.jms.DefaultJmsMessageListenerContainer | Camel
> (camel) thread #0 - JmsConsumer[que.contactCustomer.in]
>
> Compare to the startup duration (2 sec), the shutdown takes forever (11
> sec).
>
>
>
> <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://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core.xsd
>                       http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd";>
>
>
>     <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>         <property name="locations">
>             <value>file:${activemq.conf}/credentials.properties</value>
>         </property>
>     </bean>
>
>
>     <bean id="logQuery"
> class="org.fusesource.insight.log.log4j.Log4jLogQuery"
>           lazy-init="false" scope="singleton"
>           init-method="start" destroy-method="stop">
>     </bean>
>
>     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";
> depends-on="broker">
>
>
>         <route id="contactCustomer">
>             <from uri="activemq:que.contactCustomer.in"/>
>             <to uri="activemq:que.contactCustomer.out"/>
>         </route>
>     </camelContext>
>
>     <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent"
> depends-on="broker">
>         <property name="brokerURL"
> value="vm://myBroker?create=false&amp;waitForStart=5000"/>
>     </bean>
>
>
>     <broker id="broker" useJmx="true"
> xmlns="http://activemq.apache.org/schema/core"; brokerName="myBroker"
> dataDirectory="${activemq.data}">
>
>         <destinations>
>             <queue physicalName="que.contactCustomer.in"/>
>             <queue physicalName="que.contactCustomer.out"/>
>             <queue physicalName="que.contactCustomer.dlq"/>
>         </destinations>
>
>         <destinationPolicy>
>             <policyMap>
>               <policyEntries>
>                 <policyEntry topic=">" >
>
>                   <pendingMessageLimitStrategy>
>                     <constantPendingMessageLimitStrategy limit="1000"/>
>                   </pendingMessageLimitStrategy>
>                 </policyEntry>
>               </policyEntries>
>             </policyMap>
>         </destinationPolicy>
>
>
>
>         <managementContext>
>             <managementContext createConnector="false"/>
>         </managementContext>
>
>
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.data}/kahadb"/>
>         </persistenceAdapter>
>
>
>
>           <systemUsage>
>             <systemUsage>
>                 <memoryUsage>
>                     <memoryUsage percentOfJvmHeap="70" />
>                 </memoryUsage>
>                 <storeUsage>
>                     <storeUsage limit="100 gb"/>
>                 </storeUsage>
>                 <tempUsage>
>                     <tempUsage limit="50 gb"/>
>                 </tempUsage>
>             </systemUsage>
>         </systemUsage>
>
>
>         <transportConnectors>
>
>             <transportConnector name="openwire"
> uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>             <transportConnector name="amqp"
> uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>             <transportConnector name="stomp"
> uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>             <transportConnector name="mqtt"
> uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>             <transportConnector name="ws"
> uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>         </transportConnectors>
>
>
>         <shutdownHooks>
>             <bean xmlns="http://www.springframework.org/schema/beans";
> class="org.apache.activemq.hooks.SpringContextHook" />
>         </shutdownHooks>
>
>     </broker>
>
>
>     <import resource="jetty.xml"/>
>
> </beans>
>
>
>
>
> --
> View this message in context: 
> http://activemq.2283324.n4.nabble.com/Errors-because-ActiveMQ-is-shutting-down-before-CamelContext-tp4677524.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Reply via email to