3
我們有一個連接到ActivMQ apache-activemq-5.14.3的JBoss EAP 7.0.0.GA的設置。我們正試圖建立一個持久訂閱者具有以下配置:ActiveMQ - 客戶端已經連接到相同的clientId錯誤
@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:[email protected]
的ActiveMQManagedConnectionFactory設置如下(試圖最大池尺寸設置爲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專家尋求幫助。
感謝約傑什,我們也嘗試了房產置換的方式,有客戶端Id是集動態的,可悲的是沒有喘息。我們仍然得到同樣的錯誤。我們只有連接工廠池設置爲最大1個連接的單節點設置,但仍有多個線程嘗試使用相同的ClientId連接。 – dchucks