Java Code Examples for org.eclipse.paho.client.mqttv3.IMqttActionListener#onSuccess()
The following examples show how to use
org.eclipse.paho.client.mqttv3.IMqttActionListener#onSuccess() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttDeliveryToken publish(String topic, byte[] payload, int qos, boolean retained, Object userContext, IMqttActionListener callback) throws MqttException, MqttPersistenceException { if (connection.publishSuccess) { callback.onSuccess(getToken(userContext, callback, topic)); } else { callback.onFailure(getToken(userContext, callback, topic), new MqttException(0)); } return getDeliveryToken(userContext, callback, topic); }
Example 2
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttToken subscribe(String topic, int qos, Object userContext, IMqttActionListener callback) throws MqttException { if (connection.publishSuccess) { callback.onSuccess(getToken(userContext, callback, topic)); } else { callback.onFailure(getToken(userContext, callback, topic), new MqttException(0)); } return getToken(userContext, callback, topic); }
Example 3
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttToken unsubscribe(String topic, Object userContext, IMqttActionListener callback) throws MqttException { if (connection.unsubscribeSuccess) { callback.onSuccess(getToken(userContext, callback, topic)); } else { callback.onFailure(getToken(userContext, callback, topic), new MqttException(0)); } return getToken(userContext, callback, topic); }
Example 4
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttToken disconnect(long quiesceTimeout, Object userContext, IMqttActionListener callback) throws MqttException { connection.connectionStateOverwrite = MqttConnectionState.DISCONNECTED; if (connection.disconnectSuccess) { callback.onSuccess(getToken(userContext, callback, null)); } else { callback.onFailure(getToken(userContext, callback, null), new MqttException(0)); } return getToken(userContext, callback, null); }
Example 5
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttToken connect(MqttConnectOptions options, Object userContext, IMqttActionListener callback) throws MqttException, MqttSecurityException { if (!connection.connectTimeout) { connection.connectionStateOverwrite = MqttConnectionState.CONNECTED; if (connection.connectSuccess) { callback.onSuccess(getToken(userContext, callback, null)); } else { callback.onFailure(getToken(userContext, callback, null), new MqttException(0)); } } else { connection.connectionStateOverwrite = MqttConnectionState.DISCONNECTED; } return getToken(userContext, callback, null); }
Example 6
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttDeliveryToken publish(String topic, byte[] payload, int qos, boolean retained, Object userContext, IMqttActionListener callback) throws MqttException, MqttPersistenceException { if (connection.publishSuccess) { callback.onSuccess(getToken(userContext, callback, topic)); } else { callback.onFailure(getToken(userContext, callback, topic), new MqttException(0)); } return getDeliveryToken(userContext, callback, topic); }
Example 7
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttToken subscribe(String topic, int qos, Object userContext, IMqttActionListener callback) throws MqttException { if (connection.publishSuccess) { callback.onSuccess(getToken(userContext, callback, topic)); } else { callback.onFailure(getToken(userContext, callback, topic), new MqttException(0)); } return getToken(userContext, callback, topic); }
Example 8
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttToken unsubscribe(String topic, Object userContext, IMqttActionListener callback) throws MqttException { if (connection.unsubscribeSuccess) { callback.onSuccess(getToken(userContext, callback, topic)); } else { callback.onFailure(getToken(userContext, callback, topic), new MqttException(0)); } return getToken(userContext, callback, topic); }
Example 9
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttToken disconnect(long quiesceTimeout, Object userContext, IMqttActionListener callback) throws MqttException { connection.connectionStateOverwrite = MqttConnectionState.DISCONNECTED; if (connection.disconnectSuccess) { callback.onSuccess(getToken(userContext, callback, null)); } else { callback.onFailure(getToken(userContext, callback, null), new MqttException(0)); } return getToken(userContext, callback, null); }
Example 10
Source File: MqttAsyncClientEx.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public IMqttToken connect(MqttConnectOptions options, Object userContext, IMqttActionListener callback) throws MqttException, MqttSecurityException { if (!connection.connectTimeout) { connection.connectionStateOverwrite = MqttConnectionState.CONNECTED; if (connection.connectSuccess) { callback.onSuccess(getToken(userContext, callback, null)); } else { callback.onFailure(getToken(userContext, callback, null), new MqttException(0)); } } else { connection.connectionStateOverwrite = MqttConnectionState.DISCONNECTED; } return getToken(userContext, callback, null); }