无法使用 Camel 路由从外部 Artemis 服务器接收 JMS 消息,使用 JMS 组件参数并发消费者超过一个

问题描述 投票:0回答:1

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

    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

骆驼路线:

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

环境:

JBoss EAP 7.4.2 从三个外部 Artemis 2.16 服务器接收 JMS 消息,支持使用默认协议的故障转移/HA,使用 Apache Camel 2.25.4

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. 有办法避免警告/失败吗?
  2. 是否可以在 JBoss 中创建不符合 JCA 的 Artemis 连接工厂?
java jboss apache-camel jms activemq-artemis
1个回答
0
投票

您使用的 Camel 组件是为“普通”JMS 编写的

ConnectionFactory
。但是,您使用的是来自
ConnectionFactory
的基于 JCA 的
pooled-connection-factory

避免警告的方法是使用

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"/>
© www.soinside.com 2019 - 2024. All rights reserved.