-
- All Implemented Interfaces:
-
org.eclipse.paho.client.mqttv3.IMqttActionListener
public class ConnectActionListener implements IMqttActionListener
This class handles the connection of the AsyncClient to one of the available URLs.
The URLs are supplied as either the singleton when the client is created, or as a list in the connect options.
This class uses its own onSuccess and onFailure callbacks in preference to the user supplied callbacks.
An attempt is made to connect to each URL in the list until either a connection attempt succeeds or all the URLs have been tried
If a connection succeeds then the users token is notified and the users onSuccess callback is called.
If a connection fails then another URL in the list is attempted, otherwise the users token is notified and the users onFailure callback is called
-
-
Constructor Summary
Constructors Constructor Description ConnectActionListener(MqttAsyncClient client, MqttClientPersistence persistence, ClientComms comms, MqttConnectOptions options, MqttToken userToken, Object userContext, IMqttActionListener userCallback, IPahoEvents pahoEvents)
-
Method Summary
Modifier and Type Method Description voidonSuccess(IMqttToken token)If the connect succeeded then call the users onSuccess callback voidonFailure(IMqttToken token, Throwable exception)The connect failed, so try the next URI on the list. voidconnect()The connect failed, so try the next URI on the list. -
-
Constructor Detail
-
ConnectActionListener
ConnectActionListener(MqttAsyncClient client, MqttClientPersistence persistence, ClientComms comms, MqttConnectOptions options, MqttToken userToken, Object userContext, IMqttActionListener userCallback, IPahoEvents pahoEvents)
-
-
Method Detail
-
onSuccess
void onSuccess(IMqttToken token)
If the connect succeeded then call the users onSuccess callback
-
onFailure
void onFailure(IMqttToken token, Throwable exception)
The connect failed, so try the next URI on the list. If there are no more URIs, then fail the overall connect.
-
connect
void connect()
The connect failed, so try the next URI on the list. If there are no more URIs, then fail the overall connect.
-
-
-
-