Package org.springframework.pulsar.core
Class PulsarTopicBuilder
java.lang.Object
org.springframework.pulsar.core.PulsarTopicBuilder
Builder class to create
PulsarTopic
instances.- Author:
- Alexander Preuß, Chris Bono
-
Constructor Summary
ConstructorDescriptionCreate a builder instance that uses the following defaults.PulsarTopicBuilder
(org.apache.pulsar.common.naming.TopicDomain defaultDomain, String defaultTenant, String defaultNamespace) Create a builder instance that uses the specified defaults. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Constructs thePulsarTopic
with the properties configured in this builder.getFullyQualifiedNameForTopic
(String topicName) Get the fully-qualified name of the specified topic in the formatdomain://tenant/namespace/name
.Set the name of the topic under construction.numberOfPartitions
(int numberOfPartitions) Sets the number of topic partitions for the topic under construction.
-
Constructor Details
-
PulsarTopicBuilder
public PulsarTopicBuilder()Create a builder instance that uses the following defaults.-
domain -> 'persistent'
-tenant -> 'public'
-namespace -> 'default'
-
PulsarTopicBuilder
public PulsarTopicBuilder(org.apache.pulsar.common.naming.TopicDomain defaultDomain, @Nullable String defaultTenant, @Nullable String defaultNamespace) Create a builder instance that uses the specified defaults.- Parameters:
defaultDomain
- domain to use when topic name is not fully-qualifieddefaultTenant
- tenant to use when topic name is not fully-qualified or null to use the Pulsar default tenant of 'public'defaultNamespace
- namespace to use when topic name is not fully-qualified or null to use the Pulsar default namespace of 'namespace'
-
-
Method Details
-
getFullyQualifiedNameForTopic
Get the fully-qualified name of the specified topic in the formatdomain://tenant/namespace/name
.- Parameters:
topicName
- the topic name to fully qualify- Returns:
- the fully-qualified topic name
-
name
Set the name of the topic under construction. The following formats are accepted:-
When the name is not fully-qualified the missing components are populated with the corresponding default configured on the builder.'name'
-'tenant/namespace/name'
-'domain://tenant/namespace/name'
- Parameters:
name
- the topic name- Returns:
- this builder
-
numberOfPartitions
Sets the number of topic partitions for the topic under construction.- Parameters:
numberOfPartitions
- the number of topic partitions- Returns:
- this builder
-
build
Constructs thePulsarTopic
with the properties configured in this builder.- Returns:
PulsarTopic
-