Hi,
thanks for your answers.
But what is the default strategy of Openfire to select a resource to deliver to?Quoting javadoc of openfire/spi/RoutingTableImpl.routeToBareJID:
Deliver the message sent to the bare JID of a local user to the best connected resource. If the target user is not online then messages will be stored offline according to the offline strategy. However, if the user is connected from only one resource then the message will be delivered to that resource. In the case that the user is connected from many resources the logic will be the following:
- Select resources with highest priority
- Select resources with highest show value (chat, available, away, xa, dnd)
- Select resource with most recent activity
I see, this means that if all cluster nodes themselves are sending messages in regular intervals, they would become the connection with the most recent activity and so the server will do some kind of distribution.
The server would do some kind of load-balancing job.
Why not simply let the clients randomly select a resource and do so the load-balacning? This would come with the advantage that you don't depend on the server implementation and allow you to switch the server (more) easily.
This would mean that every cluster node use a different resource and the clients that produce the messages (you can think of it as a set of sensor nodes that report measurements to the cluster) randomly pick one of the cluster node resources to send their reports to. Conceptually, this would imply that every client has to be aware of the cluster nodes which is something I want to prevent. Another thing is that the cluster nodes also subscribe to PubSub nodes using their bare JID. In that case the load-balancing wouldn't work either. Depending on the server implementation is fine for me.