Interface TopicSubscriptionBuilder
-
@DoNotImplement public interface TopicSubscriptionBuilder
This builder must be used to create aTopicSubscription.Either from values or from a
Subscription.Every TopicSubscription built by this builder is fully validated against HiveMQ configuration.
- Since:
- 4.0.0, CE 2019.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull TopicSubscriptionbuild()Builds theTopicSubscriptionwith the provided values or default values.@NotNull TopicSubscriptionBuilderfromSubscription(@NotNull Subscription subscription)Create aTopicSubscriptionfrom the values of aSubscription.@NotNull TopicSubscriptionBuildernoLocal(boolean noLocal)Sets the no local flag.@NotNull TopicSubscriptionBuilderqos(@NotNull Qos qos)Sets the quality of service level.@NotNull TopicSubscriptionBuilderretainAsPublished(boolean retainAsPublished)Sets the retain as published flag.@NotNull TopicSubscriptionBuildersubscriptionIdentifier(int subscriptionIdentifier)Sets the subscription identifier.@NotNull TopicSubscriptionBuildertopicFilter(@NotNull String topicFilter)Sets the topic filter.
-
-
-
Method Detail
-
fromSubscription
@NotNull TopicSubscriptionBuilder fromSubscription(@NotNull Subscription subscription)
Create aTopicSubscriptionfrom the values of aSubscription.- Parameters:
subscription- The subscription to build aTopicSubscriptionfrom.- Returns:
- The
TopicSubscriptionBuilder. - Throws:
NullPointerException- If the subscription is null.DoNotImplementException- If theSubscriptionis implemented by the extension.- Since:
- 4.0.0, CE 2019.1
-
topicFilter
@NotNull TopicSubscriptionBuilder topicFilter(@NotNull String topicFilter)
Sets the topic filter.This value has no default and must be set.
- Parameters:
topicFilter- The topic filter to set.- Returns:
- The
TopicSubscriptionBuilder. - Throws:
NullPointerException- If the topic filter is null.IllegalArgumentException- If the topic filter is empty.IllegalArgumentException- If the topic filter contains invalid UTF-8 characters.IllegalArgumentException- If the topic filter is longer than the configured maximum. Default maximum length is 65535.IllegalArgumentException- If the topic filter contains a wildcard and wildcards are disabled by HiveMQ. Default is enabled.IllegalArgumentException- If the topic filter is a shared subscription and shared subscriptions are disabled by HiveMQ. Default is enabled.- Since:
- 4.0.0, CE 2019.1
-
qos
@NotNull TopicSubscriptionBuilder qos(@NotNull Qos qos)
Sets the quality of service level.DEFAULT:
QoS 0.- Parameters:
qos- TheQosto set.- Returns:
- The
TopicSubscriptionBuilder. - Throws:
NullPointerException- If qos is null.- Since:
- 4.0.0, CE 2019.1
-
retainAsPublished
@NotNull TopicSubscriptionBuilder retainAsPublished(boolean retainAsPublished)
Sets the retain as published flag.DEFAULT:
false.- Parameters:
retainAsPublished- The retain as published flag to set.- Returns:
- The
TopicSubscriptionBuilder. - Since:
- 4.0.0, CE 2019.1
-
noLocal
@NotNull TopicSubscriptionBuilder noLocal(boolean noLocal)
Sets the no local flag. Do not set the no local flag totrueif theTopicSubscriptionis a shared subscription.DEFAULT:
false.- Parameters:
noLocal- The no local flag to set.- Returns:
- The
TopicSubscriptionBuilder. - Since:
- 4.0.0, CE 2019.1
-
subscriptionIdentifier
@NotNull TopicSubscriptionBuilder subscriptionIdentifier(int subscriptionIdentifier)
Sets the subscription identifier.DEFAULT:
null.- Parameters:
subscriptionIdentifier- The subscription identifier to set.- Returns:
- The
TopicSubscriptionBuilder. - Throws:
IllegalArgumentException- If the subscription identifier is zero or greater than the protocol limit (268435455).IllegalArgumentException- If the subscription identifier are disabled by HiveMQ. Default is enabled.- Since:
- 4.0.0, CE 2019.1
-
build
@NotNull TopicSubscription build()
Builds theTopicSubscriptionwith the provided values or default values.- Returns:
- A
TopicSubscriptionwith the set parameters. - Throws:
NullPointerException- If the topic filter is null.IllegalArgumentException- If the noLocal flag is set for a shared subscription.- Since:
- 4.0.0, CE 2019.1
-
-