A Camel route setup in JBoss EAP 7.4.2 that tries to concurrently receive JMS messages from external ActiveMQ Artemis servers fails with following warning.
2023-xx-xx 16:04:37,066 GMT WARN [org.apache.camel.component.jms.DefaultJmsMessageListenerContainer] (Camel (StandardContext) thread #12 - JmsConsumer[XXXQueue]) Setup of JMS message listener invoker failed for destination 'XXXQueue' - trying to recover. Cause: Only allowed one session per connection. See the J2EE spec, e.g. J2EE1.4 Section 6.6
Camel route:
from("jms:queue:XXX?concurrentConsumers=2") // or more
.process("xyz")
.end();
Environment:
JBoss EAP 7.4.2 receiving JMS messages from three external ActiveMQ Artemis 2.16 servers with support for failovers/HA using default protocol, using Apache Camel 2.25.4.
ActiveMQ Artemis resource adapter settings:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
<remote-connector name="netty-artemis-sharedinternal-1" socket-binding="artemis-sharedinternal-1"/>
<remote-connector name="netty-artemis-sharedinternal-2" socket-binding="artemis-sharedinternal-2"/>
<remote-connector name="netty-artemis-sharedinternal-3" socket-binding="artemis-sharedinternal-3"/>
<pooled-connection-factory name="org.apache.activemq" entries="java:/ConnectionFactory" connectors="netty-artemis-sharedinternal-1 netty-artemis-sharedinternal-2 netty-artemis-sharedinternal-3" ha="true" failover-on-initial-connection="true" use-topology-for-load-balancing="true" transaction="none" user="user" password="password" min-pool-size="24" use-auto-recovery="true" max-pool-size="256" initial-connect-attempts="2" statistics-enabled="true" enable-amq1-prefix="false">
<inbound-config use-jndi="false" rebalance-connections="true" setup-attempts="2" setup-interval="5000"/>
</pooled-connection-factory>
...
Queries:
The Camel component you're using was written for a "normal" JMS ConnectionFactory
. However, you're using a JCA-based ConnectionFactory
from pooled-connection-factory
.
The way to avoid the warning is to use a connection-factory
rather than a pooled-connection-factory
. Here's an example based on what you already have configured:
<connection-factory name="org.apache.activemq" entries="java:/ConnectionFactory" connectors="netty-artemis-sharedinternal-1 netty-artemis-sharedinternal-2 netty-artemis-sharedinternal-3" ha="true" failover-on-initial-connection="true" use-topology-for-load-balancing="true" enable-amq1-prefix="false"/>