I am using Camel (tried 2.15.2 and 2.16.3) and the activemq-camel (tried
5.12.1 and 5.13.3) component to hook up the routes in my bundle to an
external ActiveMQ server. The bundle is deployed in Karaf (tried 3.0.5 and
4.0.5) and started via a Blueprint context (containing the Camel context).
The bundle in question only contains an amq producer.

As long as no messages were exchanged there is no issue with
uninstalling/restarting the bundle. But any time after the first message
exchange I receive a javax.jms.IllegalStateException when uninstalling the
bundle:

2016-05-30 17:12:51,937 | WARN  | V.XACML.REQUEST] |
TemporaryQueueReplyManager       | 75 - org.apache.camel.camel-jms -
2.16.3 | ID-Ralfs-MacBook-Pro-local-59456-1464621134397-7-2 | Exception
inside the DMLC for Temporary ReplyTo Queue for destination
DEV.XACML.REQUEST, refreshing ReplyTo destination
javax.jms.IllegalStateException: The Consumer is closed
    at
org.apache.activemq.ActiveMQMessageConsumer.checkClosed(ActiveMQMessageConsumer.java:880)[64:org.apache.activemq.activemq-osgi:5.13.3]
    at
org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:641)[64:org.apache.activemq.activemq-osgi:5.13.3]
    at
org.apache.activemq.jms.pool.PooledMessageConsumer.receive(PooledMessageConsumer.java:67)[64:org.apache.activemq.activemq-osgi:5.13.3]
    at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:430)[106:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
    at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:310)[106:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
    at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)[106:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
    at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1103)[106:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
    at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1095)[106:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
    at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:992)[106:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
    at java.lang.Thread.run(Thread.java:745)[:1.8.0_77]

This then causes an infinite re-try to connect back to the temporary queue:

2016-05-30 17:12:51,940 | WARN  | V.XACML.REQUEST] |
faultJmsMessageListenerContainer | 106 -
org.apache.servicemix.bundles.spring-jms - 3.2.14.RELEASE_1 |
ID-Ralfs-MacBook-Pro-local-59456-1464621134397-7-2 | Setup of JMS message
listener invoker failed for destination 'temporary' - trying to recover.
Cause: The Consumer is closed
2016-05-30 17:12:51,941 | INFO  | V.XACML.REQUEST] | PooledConnection           
     
| 64 - org.apache.activemq.activemq-osgi - 5.13.3 |
ID-Ralfs-MacBook-Pro-local-59456-1464621134397-7-2 | failed to delete
Temporary Queue
"temp-queue://ID:Ralfs-MacBook-Pro.local-59467-1464621151437-1:2:1" on
closing pooled connection: The connection is already closed
2016-05-30 17:12:51,943 | ERROR | V.XACML.REQUEST] |
faultJmsMessageListenerContainer | 106 -
org.apache.servicemix.bundles.spring-jms - 3.2.14.RELEASE_1 |
ID-Ralfs-MacBook-Pro-local-59456-1464621134397-7-2 | Could not refresh JMS
Connection for destination 'temporary' - retrying in 5000 ms. Cause: null
[rest of component shutdown logs...]
2016-05-30 17:12:56,944 | ERROR | V.XACML.REQUEST] |
faultJmsMessageListenerContainer | 106 -
org.apache.servicemix.bundles.spring-jms - 3.2.14.RELEASE_1 |  | Could not
refresh JMS Connection for destination 'temporary' - retrying in 5000 ms.
Cause: null
2016-05-30 17:13:01,948 | ERROR | V.XACML.REQUEST] |
faultJmsMessageListenerContainer | 106 -
org.apache.servicemix.bundles.spring-jms - 3.2.14.RELEASE_1 |  | Could not
refresh JMS Connection for destination 'temporary' - retrying in 5000 ms.
Cause: null
2016-05-30 17:13:06,953 | ERROR | V.XACML.REQUEST] |
faultJmsMessageListenerContainer | 106 -
org.apache.servicemix.bundles.spring-jms - 3.2.14.RELEASE_1 |  | Could not
refresh JMS Connection for destination 'temporary' - retrying in 5000 ms.
Cause: null
2016-05-30 17:13:11,956 | ERROR | V.XACML.REQUEST] |
faultJmsMessageListenerContainer | 106 -
org.apache.servicemix.bundles.spring-jms - 3.2.14.RELEASE_1 |  | Could not
refresh JMS Connection for destination 'temporary' - retrying in 5000 ms.
Cause: null
[...]

How would I have to set up my context in order to support bundle re-starts
and still use temporary queues for request-reply messaging?

My current configuration looks like this:

<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="${activemq.broker.url} />
    <property name="userName" value="${activemq.user}" />
    <property name="password" value="${activemq.password}" />
    <property name="useAsyncSend" value="true" />
</bean>

<bean id="pooledConnectionFactoryProducer"
class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start"
destroy-method="stop">
    <property name="maxConnections" value="${activemq.maxconnections}" />
    <property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>

<bean id="jmsConfigProducer"
class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="pooledConnectionFactoryProducer"
/>
    <property name="deliveryPersistent" value="false" />
    <property name="replyToDeliveryPersistent" value="false" />
    <property name="transacted" value="false" />
</bean>

<bean id="amq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="configuration" ref="jmsConfigProducer" />
</bean>

Cross-posted here:
http://stackoverflow.com/questions/37529493/uninstalling-blueprint-bundle-using-activemq-pooledconnectionfactory-causes-java

Thanks in advance!
Ralf



--
View this message in context: 
http://camel.465427.n5.nabble.com/Uninstalling-Blueprint-bundle-using-ActiveMQ-PooledConnectionFactory-causes-javax-jms-IllegalStateExd-tp5783393.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to