Reputation: 1
i am running
When i test my Camel routes having AMQ endpoints and the test method finishes, the AMQ is shutdown earlier than the Camel routes. Causing the routes endpoints throwing a lot of lost connection exceptions, especially when there are inflights. The start level of the AMQ is much lower than my routes. How can i ensure the shutdown sequence: - route, - amq, - servicemix ?
Upvotes: 0
Views: 182
Reputation: 4316
Specify to have your Camel route (or test bundle) depend on the ActiveMQ broker service. When the bundles are being shutdown, they will be shutdown in reverse dependency order and the broker (which doesn't depend on any of your coded services) should shutdown towards the end.
<bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
init-method="start" destroy-method="stop">
...
</bean>
Updated:
This allows OSGi to deterministically configure the proper startup and shutdown based on explicit dependency vs arbitrary (what you have now) or a number-ordered convention.
<camelContext depends-on="activemq-broker">
</camelContext>
<reference id="activemq-broker"
availability="mandatory"
timeout="5000"
interface="org.osgi.service.cm.ManagedService"
filter="(service.pid=org.apache.servicemix.activemq.service)"/>
Upvotes: 0