Class SubscribePacket.SubscribePacketBuilder

java.lang.Object
software.amazon.awssdk.crt.mqtt5.packets.SubscribePacket.SubscribePacketBuilder
Enclosing class:
SubscribePacket

public static final class SubscribePacket.SubscribePacketBuilder extends Object
A class to that allows for the creation of a SubscribePacket. Set all of the settings you want in the packet and then use the build() function to get a SubscribePacket populated with the settings defined in the builder.
  • Constructor Details

    • SubscribePacketBuilder

      public SubscribePacketBuilder()
      Creates a new SubscribePacketBuilder so a SubscribePacket can be created.
    • SubscribePacketBuilder

      public SubscribePacketBuilder(SubscribePacket.Subscription subscription)
      Creates a new SubscribePacketBuilder with one subscription defined.
      Parameters:
      subscription - The subscription to add within the SubscribePacket.
    • SubscribePacketBuilder

      public SubscribePacketBuilder(String topicFilter, QOS qos)
      Creates a new SubscribePacketBuilder with one subscription defined.
      Parameters:
      topicFilter - The topic filter to subscribe to.
      qos - The maximum QoS on which the subscriber will accept publish messages.
  • Method Details

    • withSubscription

      Sets a single subscription within the SubscribePacket.
      Parameters:
      subscription - The subscription to add within the SubscribePacket.
      Returns:
      The SubscribePacketBuilder after setting the subscription.
    • withSubscription

      public SubscribePacket.SubscribePacketBuilder withSubscription(String topicFilter, QOS qos, Boolean noLocal, Boolean retainAsPublished, SubscribePacket.RetainHandlingType retainHandlingType)
      Sets a single subscription within the SubscribePacket.
      Parameters:
      topicFilter - The topic filter to subscribe to
      qos - The maximum QoS on which the subscriber will accept publish messages
      noLocal - Whether the server will not send publishes to a client when that client was the one who sent the publish
      retainAsPublished - Whether messages sent due to this subscription keep the retain flag preserved on the message
      retainHandlingType - Whether retained messages on matching topics be sent in reaction to this subscription
      Returns:
      The SubscribePacketBuilder after setting the subscription.
    • withSubscription

      public SubscribePacket.SubscribePacketBuilder withSubscription(String topicFilter, QOS qos)
      Sets a single subscription within the SubscribePacket.
      Parameters:
      topicFilter - The topic filter to subscribe to
      qos - The maximum QoS on which the subscriber will accept publish messages
      Returns:
      The SubscribePacketBuilder after setting the subscription.
    • withSubscriptionIdentifier

      public SubscribePacket.SubscribePacketBuilder withSubscriptionIdentifier(long subscriptionIdentifier)
      Sets the positive long to associate with all topic filters in this request. Publish packets that match a subscription in this request should include this identifier in the resulting message. See MQTT5 Subscription Identifier
      Parameters:
      subscriptionIdentifier - A positive long to associate with all topic filters in this request.
      Returns:
      The SubscribePacketBuilder after setting the subscription identifier.
    • withUserProperties

      public SubscribePacket.SubscribePacketBuilder withUserProperties(List<UserProperty> userProperties)
      Sets the list of MQTT5 user properties included with the packet. See MQTT5 User Property
      Parameters:
      userProperties - List of MQTT5 user properties to be included with the packet.
      Returns:
      The SubscribePacketBuilder after setting the user properties.
    • build

      public SubscribePacket build()
      Creates a new SUBSCRIBE packet using the settings set in the builder.
      Returns:
      The SubscribePacket created from the builder