Clustered WildFly 10 domain messaging

為{幸葍}努か 提交于 2019-12-06 04:50:19

As I've come with the exactly same question - put the answer here.

Yes, messages should be delivered to all nodes if a destination is a Topic.

With the default configuration ActiveMQ Artemis uses broadcast to discover and connect to other ActiveMQ instances on other nodes (within the same discovery-group):

<discovery-group name="dg-group1" jgroups-channel="activemq-cluster"/>
<cluster-connection name="my-cluster" discovery-group="dg-group1" connector-name="http-connector" address="jms"/>

Still need to ensure that a JNDI name for a jms-topic starts with the "jms" to match the address="jms" in the line above (what is OK in your case: "java:/jms/my-topic")

The only thing missed in your example to get it working on all nodes is :
<cluster password="yourPassword" user="activemqUser"/>
(for sure activemqUser user must be added earlier, e.g. with the addUser.sh script).

This let ActiveMQ instances to communicate each other. So called Core Bridge connection is created between nodes. As stated in ActiveMQ manual :

..this is done transparently behind the scenes - you don't have to declare an explicit bridge for each node

If everything is OK then the bridge may be found in server.log: AMQ221027: Bridge ClusterConnectionBridge@63549ead [name=sf.my-cluster ...] is connected.

Btw, if a destination is a Queue then ActiveMQ will not send a message to other nodes unless a message is not consumed locally.

P.s. as answered here this refers to a classic approach to distribute an event to all nodes in a cluster.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!