我们有一个连接到 ActivMQ apache-activemq-5.14.3 的 JBoss EAP 7.0.0.GA 设置。我们正在尝试使用以下配置设置持久订阅者:
@MessageDriven(
name = "TestListener",
activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability",
propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "subscriptionName",
propertyValue = "subscriptionNameTest"),
@ActivationConfigProperty(propertyName = "clientId",
propertyValue = "2"),
@ActivationConfigProperty(propertyName = "destination",
propertyValue = "jms/testTopic")
}
)
@PermitAll
@ResourceAdapter(value="activemq-rar.rar")
但是,我们在 JBoss 服务器控制台中遇到以下异常
ERROR [org.apache.activemq.ra.ActiveMQEndpointWorker] (default-threads - 4) Failed to connect to broker [tcp://127.0.0.1:61616?jms.rmIdFromConnectionId=true]: Broker: TestBroker - Client: 2 already connected from tcp://127.0.0.1:64246: javax.jms.InvalidClientIDException: Broker: TestBroker - Client: 2 already connected from tcp://127.0.0.1:64246
同时如果我们在 activmq 看到如下日志:
WARN | Failed to add Connection ID: 40600-51:1 due to javax.jms.InvalidClientIDException: Broker: TestBroker - Client: 2 already connected from tcp://127.0.0.1:64246 | org.apache.activemq.broker.TransportConnection | ActiveMQ Transport: tcp:///127.0.0.1:50170@61616
ActiveMQManagedConnectionFactory 设置如下(尝试将 max-pool-size 设置为 1,但没有效果):
/subsystem=resource-adapters/resource-adapter=activemq-rar.rar/connection-definitions=ConnectionFactory:add(class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory", jndi-name="java:/MyConnectionFactory", enabled=true, min-pool-size=1, max-pool-size=20, pool-prefill=false, same-rm-override=false, recovery-username=ejb_user, recovery-password=xxxxx)
请向 AMQ 专家寻求帮助。