public class AWSIotTopic extends AWSIotMessage implements AwsIotTopicCallback
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
.
errorCode, errorMessage, payload, qos, topic
Constructor and Description |
---|
AWSIotTopic(String topic)
Instantiates a new topic object.
|
AWSIotTopic(String topic,
AWSIotQos qos)
Instantiates a new topic object.
|
Modifier and Type | Method and Description |
---|---|
void |
onMessage(AWSIotMessage message)
Callback function to be invoked upon the arrival of a subscribed message.
|
getErrorCode, getErrorMessage, getPayload, getQos, getStringPayload, getTopic, onFailure, onSuccess, onTimeout, setErrorCode, setErrorMessage, setPayload, setQos, setStringPayload, setTopic
public AWSIotTopic(String topic)
topic
- the topic to be subscribed topublic void onMessage(AWSIotMessage message)
onMessage
in interface AwsIotTopicCallback
message
- the message receivedCopyright © 2020. All rights reserved.