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 Summary
Constructors Constructor Description SubscribePacketBuilder()
Creates a new SubscribePacketBuilder so a SubscribePacket can be created.SubscribePacketBuilder(String topicFilter, QOS qos)
Creates a new SubscribePacketBuilder with one subscription defined.SubscribePacketBuilder(SubscribePacket.Subscription subscription)
Creates a new SubscribePacketBuilder with one subscription defined.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SubscribePacket
build()
Creates a new SUBSCRIBE packet using the settings set in the builder.SubscribePacket.SubscribePacketBuilder
withSubscription(String topicFilter, QOS qos)
Sets a single subscription within the SubscribePacket.SubscribePacket.SubscribePacketBuilder
withSubscription(String topicFilter, QOS qos, Boolean noLocal, Boolean retainAsPublished, SubscribePacket.RetainHandlingType retainHandlingType)
Sets a single subscription within the SubscribePacket.SubscribePacket.SubscribePacketBuilder
withSubscription(SubscribePacket.Subscription subscription)
Sets a single subscription within the SubscribePacket.SubscribePacket.SubscribePacketBuilder
withSubscriptionIdentifier(long subscriptionIdentifier)
Sets the positive long to associate with all topic filters in this request.SubscribePacket.SubscribePacketBuilder
withUserProperties(List<UserProperty> userProperties)
Sets the list of MQTT5 user properties included with the packet.
-
-
-
Constructor Detail
-
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.
-
-
Method Detail
-
withSubscription
public SubscribePacket.SubscribePacketBuilder withSubscription(SubscribePacket.Subscription subscription)
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 toqos
- The maximum QoS on which the subscriber will accept publish messagesnoLocal
- Whether the server will not send publishes to a client when that client was the one who sent the publishretainAsPublished
- Whether messages sent due to this subscription keep the retain flag preserved on the messageretainHandlingType
- 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 toqos
- 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
-
-