无法使用参数concurrentConsumers(多个)的JMS组件从具有Camel路由的外部Artemis服务器接收JMS消息

hrysbysz  于 2023-10-18  发布在  Apache
关注(0)|答案(1)|浏览(112)

JBoss EAP 7.4.2中的Camel路由设置尝试从外部ActiveMQ Artemis服务器并发接收JMS消息时失败,并出现以下警告。

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 路线:**

from("jms:queue:XXX?concurrentConsumers=2") // or more
    .process("xyz")
    .end();

环境:
JBoss EAP 7.4.2从三个外部ActiveMQ Artemis 2.16服务器接收JMS消息,支持使用默认协议的故障转移/HA,使用Apache Camel 2.25.4
ActiveMQ Artemis资源适配器设置:

<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>
        ...

密码:

1.是否有避免警告/故障的变通方法?
1.是否可以在JBoss中创建不符合JCA的Artemis连接工厂?

ycggw6v2

ycggw6v21#

您正在使用的Camel组件是为“普通”JMS ConnectionFactory编写的。但是,您使用的是来自pooled-connection-factory的基于JCA的ConnectionFactory
避免警告的方法是使用connection-factory而不是pooled-connection-factory。下面是一个基于您已经配置的示例:

<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"/>

相关问题