我在将MDB设置为侦听Windows OS的JBoss EAP 6.4.2上的多个远程服务器时遇到问题。当我将2台服务器设置为在connectionParameters
上侦听时,它仅从其中一台获取消息。
如果仅将一台服务器设置为侦听,则效果很好。但是不能同时收听2个或更多服务器。以下是我的MDB
@MessageDriven(mappedName = "TestTopicRemote", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "cacheTopic"),
@ActivationConfigProperty(propertyName = "connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory,org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"),
@ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=172.16.116.32;port=5445,host=172.16.116.107;port=5445"),
@ActivationConfigProperty(propertyName = "user", propertyValue = "guest"),
@ActivationConfigProperty(propertyName = "password", propertyValue = "password1")}
)
答案 0 :(得分:1)
我相信您通常误解了connectionParameters
激活配置属性提供的功能和MDB功能。 JBoss EAP中的JMS MDB无法直接从多个代理接收消息。
connectionParameters
激活配置属性支持多个条目,但实际上仅使用一个。通常,这些条目用于群集中的所有服务器或HA对的主从服务器。
Artemis经纪人是否在集群的172.16.116.32
和172.16.116.107
上运行?如果是这样,那么假设集群中的代理具有适当的配置,则连接到集群中任何节点的使用者都应该能够接收产生到集群中任何其他节点的消息。