Class AWSIotTopic
- java.lang.Object
-
- com.amazonaws.services.iot.client.AWSIotMessage
-
- com.amazonaws.services.iot.client.AWSIotTopic
-
- All Implemented Interfaces:
AwsIotMessageCallback,AwsIotTopicCallback
- Direct Known Subclasses:
AwsIotDeviceCommandAckListener,AwsIotDeviceDeltaListener
public class AWSIotTopic extends AWSIotMessage implements AwsIotTopicCallback
This class is used for subscribing to a topic in the subscription APIs, such asAWSIotMqttClient.subscribe(AWSIotTopic topic).In contains a callback function,
onMessage(com.amazonaws.services.iot.client.AWSIotMessage), that is invoked when a subscribed message has arrived. In most cases, applications are expected to override the defaultonMessage(com.amazonaws.services.iot.client.AWSIotMessage)method in order to access the message payload.This class extends
AWSIotMessage, therefore callback functions inAWSIotMessagecan also be overridden if the application wishes to be invoked for the outcomes of the subscription API. For more details, please refer toAWSIotMessage.
-
-
Field Summary
-
Fields inherited from class com.amazonaws.services.iot.client.AWSIotMessage
errorCode, errorMessage, payload, qos, topic
-
-
Constructor Summary
Constructors Constructor Description AWSIotTopic(String topic)Instantiates a new topic object.AWSIotTopic(String topic, AWSIotQos qos)Instantiates a new topic object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonMessage(AWSIotMessage message)Callback function to be invoked upon the arrival of a subscribed message.-
Methods inherited from class com.amazonaws.services.iot.client.AWSIotMessage
getErrorCode, getErrorMessage, getPayload, getQos, getStringPayload, getTopic, onFailure, onSuccess, onTimeout, setErrorCode, setErrorMessage, setPayload, setQos, setStringPayload, setTopic
-
-
-
-
Constructor Detail
-
AWSIotTopic
public AWSIotTopic(String topic)
Instantiates a new topic object.- Parameters:
topic- the topic to be subscribed to
-
-
Method Detail
-
onMessage
public void onMessage(AWSIotMessage message)
Callback function to be invoked upon the arrival of a subscribed message.- Specified by:
onMessagein interfaceAwsIotTopicCallback- Parameters:
message- the message received
-
-