Class SubscribePacket.SubscribePacketBuilder
java.lang.Object
software.amazon.awssdk.crt.mqtt5.packets.SubscribePacket.SubscribePacketBuilder
- Enclosing class:
- SubscribePacket
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
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionbuild()
Creates a new SUBSCRIBE packet using the settings set in the builder.withSubscription
(String topicFilter, QOS qos) Sets a single subscription within the SubscribePacket.withSubscription
(String topicFilter, QOS qos, Boolean noLocal, Boolean retainAsPublished, SubscribePacket.RetainHandlingType retainHandlingType) Sets a single subscription within the SubscribePacket.withSubscription
(SubscribePacket.Subscription subscription) Sets a single subscription within the SubscribePacket.withSubscriptionIdentifier
(long subscriptionIdentifier) Sets the positive long to associate with all topic filters in this request.withUserProperties
(List<UserProperty> userProperties) Sets the list of MQTT5 user properties included with the packet.
-
Constructor Details
-
SubscribePacketBuilder
public SubscribePacketBuilder()Creates a new SubscribePacketBuilder so a SubscribePacket can be created. -
SubscribePacketBuilder
Creates a new SubscribePacketBuilder with one subscription defined.- Parameters:
subscription
- The subscription to add within the SubscribePacket.
-
SubscribePacketBuilder
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
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
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
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
Creates a new SUBSCRIBE packet using the settings set in the builder.- Returns:
- The SubscribePacket created from the builder
-