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
This class is used for subscribing to a topic in the subscription APIs, such
as
AWSIotMqttClient.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 default onMessage(com.amazonaws.services.iot.client.AWSIotMessage) method in order to access the message
payload.
This class extends AWSIotMessage, therefore callback functions in
AWSIotMessage can also be overridden if the application wishes to be
invoked for the outcomes of the subscription API. For more details, please
refer to AWSIotMessage.
-
Field Summary
Fields inherited from class com.amazonaws.services.iot.client.AWSIotMessage
errorCode, errorMessage, payload, qos, topic -
Constructor Summary
ConstructorsConstructorDescriptionAWSIotTopic(String topic) Instantiates a new topic object.AWSIotTopic(String topic, AWSIotQos qos) Instantiates a new topic object. -
Method Summary
Modifier and TypeMethodDescriptionvoidonMessage(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 Details
-
AWSIotTopic
Instantiates a new topic object.- Parameters:
topic- the topic to be subscribed to
-
AWSIotTopic
Instantiates a new topic object.- Parameters:
topic- the topic to be subscribed toqos- the MQTT QoS level for the subscription
-
-
Method Details
-
onMessage
Callback function to be invoked upon the arrival of a subscribed message.- Specified by:
onMessagein interfaceAwsIotTopicCallback- Parameters:
message- the message received
-