I was wondering how Openfire handles multiple active connections of the same JID with different resources that all have the same priority. When sending a message to the JID (without specifying a resource), the server has some options how to handle this.
According to the XMPP spec (RFC 3921, section 11.1) the options in this case are
“…If two or more available resources have the same priority, the server MAY use some other rule (e.g., most recent connect time, most recent activity time, or highest availability as determined by some hierarchy of values) to choose between them or MAY deliver the message to all such resources…”.
I have noticed that there is some setting (route.all-resources) to switch to the second option (deliver all)? But what is the default strategy of Openfire to select a resource to deliver to?
Without digging too much into the code, is it possible to achieve a kind of round-robin message delivery in this case? This might not make sense for instant messages, but I would like to use this for M2M communication where the messages contain data that has to be processed by a service. In order to cluster the service it would be great to have every cluster node be connected with the same JID but different resource and to have the messages distributed among the cluster nodes. The server would do some kind of load-balancing job.