Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] High availability in server URIs

Hi all,

I'm reviewing the source code of MqttOptions to know more of Server URIs and I can read the following internal comment:

* Specifying a list of servers that a client may connect to has several uses:
* <ol>
* <li>High Availability and reliable message delivery
* <p>Some MQTT servers support a high availability feature where two or more
* "equal" MQTT servers share state. An MQTT client can connect to any of the "equal"
* servers and be assured that messages are reliably delivered and durable subscriptions
* are maintained no matter which server the client connects to.
* <p>The cleansession flag must be set to false if durable subscriptions and/or reliable
* message delivery is required.
* <li>Hunt List
* <p>A set of servers may be specified that are not "equal" (as in the high availability
* option). As no state is shared across the servers reliable message delivery and
* durable subscriptions are not valid. The cleansession flag must be set to true if the
* hunt list mode is used
* </ol>
* </p>
* @param array of serverURIs
*/
public void setServerURIs(String[] array) {
for (int i = 0; i < array.length; i++) {
validateURI(array[i]);
}
this.serverURIs = array;
}

AFAIK, the server URIs are defined to try one by one until a connection can be stablished, but there is a part of the comment that makes me doubt. What does exactly "(as in the high availability option)" mean? Is there an additional option to define the MQTT connection as high available? I cannot find additional information about that.

In addition, I've two questions:

- Is there a possibility of defining a set of server URIs but chose that the MqttClient randomly use one of them? Now It starts with the first one and follows with the second... and so on. I would like that in every connection the MqttClient uses one of them but not always starting with the first one.

- After a disconnection, does the MqttClient use the previous URI to reconnect (the one that is disconnected now) or does it uses the next one of the URIs list?

I've a set of MQTT brokers behind a load balancer ("equal" brokers) and I'm wondering whether I could remove the load balancer and use this potential feature instead of it.

Regards.

--
---
Manuel Domínguez Dorado
Software engineer (Ph.D, M.Sc., B.Sc.)
Certified Project Management Professional (PMP)

ingeniero@xxxxxxxxxxxxxxxxxxx
http://www.ManoloDominguez.com
(+34) 607 418 760


Back to the top