本文整理匯總了Java中org.eclipse.paho.client.mqttv3.IMqttDeliveryToken.getTopics方法的典型用法代碼示例。如果您正苦於以下問題:Java IMqttDeliveryToken.getTopics方法的具體用法?Java IMqttDeliveryToken.getTopics怎麽用?Java IMqttDeliveryToken.getTopics使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.paho.client.mqttv3.IMqttDeliveryToken
的用法示例。
在下文中一共展示了IMqttDeliveryToken.getTopics方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deliveryComplete
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; //導入方法依賴的package包/類
/**
* Callback method which gets triggered upon successful completion of a message delivery to
* the broker.
*
* @param iMqttDeliveryToken the MQTT-DeliveryToken which includes the details about the
* specific message delivery.
*/
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
String message = "";
try {
message = iMqttDeliveryToken.getMessage().toString();
} catch (MqttException e) {
log.error(
"Error occurred whilst trying to read the message from the MQTT delivery " +
"token.");
}
String topic = iMqttDeliveryToken.getTopics()[0];
String client = iMqttDeliveryToken.getClient().getClientId();
if (log.isDebugEnabled()) {
log.debug("Message - '" + message + "' of client [" + client + "] for the topic (" +
topic +
") was delivered successfully.");
}
}
示例2: deliveryComplete
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; //導入方法依賴的package包/類
/**
* Callback method which gets triggered upon successful completion of a message delivery to
* the broker.
*
* @param iMqttDeliveryToken the MQTT-DeliveryToken which includes the details about the
* specific message delivery.
*/
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
String message = "";
try {
message = iMqttDeliveryToken.getMessage().toString();
} catch (MqttException e) {
//TODO:: Throw errors
log.error(
"Error occurred whilst trying to read the message from the MQTT delivery " +
"token.");
}
String topic = iMqttDeliveryToken.getTopics()[0];
String client = iMqttDeliveryToken.getClient().getClientId();
if (log.isDebugEnabled()) {
log.debug("Message - '" + message + "' of client [" + client + "] for the topic (" +
topic + ") was delivered successfully.");
}
}
示例3: deliveryComplete
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; //導入方法依賴的package包/類
/**
* Callback method which gets triggered upon successful completion of a message delivery to
* the broker.
*
* @param iMqttDeliveryToken the MQTT-DeliveryToken which includes the details about the
* specific message delivery.
*/
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
String message = "";
try {
message = iMqttDeliveryToken.getMessage().toString();
} catch (MqttException e) {
log.error(
"Error occurred whilst trying to read the message from the MQTT delivery " +
"token.");
}
String topic = iMqttDeliveryToken.getTopics()[0];
String client = iMqttDeliveryToken.getClient().getClientId();
if (log.isDebugEnabled()) {
log.debug("Message - '" + message + "' of client [" + client + "] for the topic (" +
topic + ") was delivered successfully.");
}
}
示例4: deliveryComplete
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; //導入方法依賴的package包/類
/**
* Callback method which gets triggered upon successful completion of a message delivery to the broker.
*
* @param iMqttDeliveryToken the MQTT-DeliveryToken which includes the details about the specific message delivery.
*/
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
String topic = iMqttDeliveryToken.getTopics()[0];
String client = iMqttDeliveryToken.getClient().getClientId();
try {
if (iMqttDeliveryToken.isComplete()) {
if (iMqttDeliveryToken.getMessage() != null) {
String message = iMqttDeliveryToken.getMessage().toString();
Log.d(TAG, "Message to client [" + client + "] under topic (" + topic +
") was delivered successfully with the delivery message: '" + message + "'");
} else {
Log.d(TAG, "Message to client [" + client + "] under topic (" + topic +
") was delivered successfully.");
}
} else {
Log.w(TAG, "FAILED: Delivery of MQTT message to [" + client + "] under topic [" + topic + "] failed.");
}
} catch (MqttException e) {
Log.w(TAG, "Error occurred whilst trying to read the message from the MQTT delivery token.");
}
}
示例5: deliveryComplete
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; //導入方法依賴的package包/類
/**
* Inform when message delivery is complete for a published message.
*
* @param iMqttDeliveryToken The message complete token
*/
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
for (String topic : iMqttDeliveryToken.getTopics()) {
log.info("Message delivered successfully to topic : \"" + topic + "\".");
}
}