Package org.springframework.pulsar.core
Record Class PulsarTopic
java.lang.Object
java.lang.Record
org.springframework.pulsar.core.PulsarTopic
- Record Components:
topicName
- the fully qualified topic name in the format'domain://tenant/namespace/name'
numberOfPartitions
- the number of partitions, or 0 for non-partitioned topics
Represents a Pulsar topic.
The input topicName
must be fully-qualified. As such, it is recommended to use
the PulsarTopicBuilder
to create instances like this:
PulsarTopic topic = new PulsarTopicBuilder().name("my-topic").build();
The builder is more lenient and allows non-fully-qualified topic names to be
input and fully qualifies the output name using its configured default tenant and
namepsace.- Author:
- Alexander Preuß, Chris Bono
- See Also:
-
Constructor Summary
ConstructorDescriptionPulsarTopic
(String topicName, int numberOfPartitions) Creates an instance of aPulsarTopic
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic PulsarTopicBuilder
Deprecated, for removal: This API element is subject to removal in a future version.final boolean
Indicates whether some other object is "equal to" this one.org.springframework.pulsar.core.PulsarTopic.TopicComponents
Get the individual identifying components of a Pulsar topic.Deprecated, for removal: This API element is subject to removal in a future version.As of version 1.2.0 topicName must always be fully qualified, usetopicName()
instead.final int
hashCode()
Returns a hash code value for this object.boolean
Checks if the topic is partitioned.int
Returns the value of thenumberOfPartitions
record component.Returns the value of thetopicName
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
PulsarTopic
Creates an instance of aPulsarTopic
record class.- Parameters:
topicName
- the value for thetopicName
record componentnumberOfPartitions
- the value for thenumberOfPartitions
record component
-
-
Method Details
-
builder
@Deprecated(since="1.2.0", forRemoval=true) public static PulsarTopicBuilder builder(String topicName) Deprecated, for removal: This API element is subject to removal in a future version.since 1.2.0 for removal in 1.4.0 in favor ofPulsarTopicBuilder()
orPulsarTopicBuilder(TopicDomain, String, String)
Convenience method to create a topic builder with the specified topic name.- Parameters:
topicName
- the name of the topic- Returns:
- the topic builder instance
-
isPartitioned
public boolean isPartitioned()Checks if the topic is partitioned.- Returns:
- true if the topic is partitioned
-
getComponents
public org.springframework.pulsar.core.PulsarTopic.TopicComponents getComponents()Get the individual identifying components of a Pulsar topic.- Returns:
PulsarTopic.TopicComponents
-
getFullyQualifiedTopicName
Deprecated, for removal: This API element is subject to removal in a future version.As of version 1.2.0 topicName must always be fully qualified, usetopicName()
instead.Get the fully-qualified name of this topic in the formatdomain://tenant/namespace/name
where the components have the following defaults when not specified in the original topic name used to build this topic.-
domain
is one of ('persistent', 'non-persistent') with a default of 'persistent' -tenant
has default of 'public' -namespace
has default of 'default'- Returns:
- the fully-qualified topic name
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
topicName
Returns the value of thetopicName
record component.- Returns:
- the value of the
topicName
record component
-
numberOfPartitions
public int numberOfPartitions()Returns the value of thenumberOfPartitions
record component.- Returns:
- the value of the
numberOfPartitions
record component
-
PulsarTopicBuilder()
orPulsarTopicBuilder(TopicDomain, String, String)