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 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.

  • Constructor Details

    • AWSIotTopic

      public AWSIotTopic(String topic)
      Instantiates a new topic object.
      Parameters:
      topic - the topic to be subscribed to
    • AWSIotTopic

      public AWSIotTopic(String topic, AWSIotQos qos)
      Instantiates a new topic object.
      Parameters:
      topic - the topic to be subscribed to
      qos - the MQTT QoS level for the subscription
  • Method Details

    • onMessage

      public void onMessage(AWSIotMessage message)
      Callback function to be invoked upon the arrival of a subscribed message.
      Specified by:
      onMessage in interface AwsIotTopicCallback
      Parameters:
      message - the message received