Jboss ActiveMQ-客户端已连接到同一个clientId错误
我们有一个JBoss EAP 7.0.0.GA的设置,连接到ActivVMQ apache-activemq-5.14.3。我们正在尝试使用以下配置设置持久订户:Jboss ActiveMQ-客户端已连接到同一个clientId错误,jboss,jms,activemq,message-driven-bean,durable-subscription,Jboss,Jms,Activemq,Message Driven Bean,Durable Subscription,我们有一个JBoss EAP 7.0.0.GA的设置,连接到ActivVMQ apache-activemq-5.14.3。我们正在尝试使用以下配置设置持久订户: @MessageDriven( name = "TestListener", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType",
@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")
@ActivationConfigProperty(propertyName="clientId", propertyValue = "2-${jboss.node.name}")
但是,我们在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设置如下(已尝试将最大池大小设置为1,但无效):
请向AMQ专家寻求帮助。也许,更改属性/配置可以解决您的问题。 例如,尝试使用以下配置更改客户端id:
@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")
@ActivationConfigProperty(propertyName="clientId", propertyValue = "2-${jboss.node.name}")
这将确保您的clientId是唯一的我能够让AMQ和jboss在没有上千个线程的情况下运行的唯一方法是使用嵌入式代理设置RAR,然后将嵌入式代理与您的外部代理进行网络连接。感谢Yogesh,我们尝试了属性替换方法,动态地设置ClientId,不幸的是没有喘息的机会。我们仍然得到相同的错误。我们只有单节点设置,连接工厂池设置为最多1个连接,但仍有多个线程尝试使用相同的ClientId进行连接。我不明白您在这里说什么。您能提供更多详细信息吗?activemq rar文件的部分设置是配置broker.xml文件。在这个文件中,您可以启用一个嵌入式代理,该代理将通过网络连接到外部代理。提到