pooled-connection-factory is load-balancing connections by default. Connector(s) which you're specifying in configuration are used for initial connection. Then cluster topology is loaded and 2nd connection usually points to another server in cluster. Default load-balancing policy is round-robin.
what if we don't know which server is live at the moment of clients first connection and initial connection failed? In that case clients won't be able to load cluster topology.
Can we use discovery group address? On the other project I'm using hornetq cluster and clients from JBoss connects to cluster via resource adapter. All configuration is in ra.xml, we can define DiscoveryAddress and DiscoveryPort and everything works fine.
I know that things has changed in Wildfly and artemis-ra is somehow 'hidden' (the RA is constructed programmatically by the messaging system). Is there option to configure activemq RA in Wildfly? To configure discovery address and port
yes, discovery group will solve the problem with identification of live and backup servers and will load-balance connections to live.
You're right that configuration of Artemis RA has changed. Currently Artemis RA is configured in messaging-activemq subsystem using pooled-connection-factory which configures outbound and inbound connection at the same time. You'll need to set your discovery-group in pooled-connection-factory so it' used for this purpose:
... <discovery-group name="dg-group1" jgroups-channel="activemq-cluster" refresh-timeout="10000"/> <pooled-connection-factory name="activemq-ra" ... discovery-group="dg-group1" ... /> ...
Thank you for response. I've figured it out on Friday night but weekend caught me and I didn't manage to answer myself here
Anyways, I solved it very similar with only difference I used UDP:
<discovery-group name="dg-artemis" socket-binding="artemis-discovery"/> <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA" discovery-group="dg-artemis" ha="true"/> ... <socket-binding name="artemis-discovery" interface="messenger" multicast-address="126.96.36.199" multicast-port="9876"/>
In my local env I had issue with discovery cluster from WF, I received errors during startup like:
AMQ122018: Could not start recovery discovery on XARecoveryConfig ... we will retry every recovery scan until the server is available
.. so I had to add to interfaces:
<interface name="messenger"> <any-address/> </interface>
Great that you've manged to solve it :-) and nice solution with any-address interface.
AMQ122018: Could not start...
probably relates to the problem that Recovery Manager could not find interface where it should listen to multicast 188.8.131.52:9876. I'm happy to see that using
is working which is basically equivalent to setting 0.0.0.0.