Package org.apache.pulsar.common.naming
Class TopicName
java.lang.Object
org.apache.pulsar.common.naming.TopicName
- All Implemented Interfaces:
ServiceUnitId
Encapsulate the parsing of the completeTopicName name.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic TopicNamestatic TopicNamestatic TopicNamestatic TopicNameget(String domain, NamespaceName namespaceName, String topic) Deprecated.org.apache.pulsar.common.naming.TopicDomainGet a string suitable for completeTopicName lookup.Extract the namespace portion out of a completeTopicName name.Get the namespace object that this completeTopicName belongs to.getPartition(int index) For partitions in a topic, return the base partitioned topic name.static TopicNamegetPartitionedTopicName(String topic) intstatic intgetPartitionIndex(String topic) Returns the name of the persistence resource associated with the completeTopicName.Returns the http rest path for use in the admin web service.getRestPath(boolean includeDomain) inthashCode()booleanCheck whether a fully-qualified topic is included in thisServiceUnitIdobject.booleanisGlobal()booleanbooleanbooleanisV2()Returns true if this a V2 topic name prop/ns/topic-name.static booleantoString()
-
Field Details
-
PUBLIC_TENANT
- See Also:
-
DEFAULT_NAMESPACE
- See Also:
-
PARTITIONED_TOPIC_SUFFIX
- See Also:
-
-
Method Details
-
get
-
get
-
get
-
get
-
getPartitionedTopicName
-
isValid
-
isPersistent
public boolean isPersistent() -
getNamespace
Extract the namespace portion out of a completeTopicName name.Works both with old & new convention.
- Returns:
- the namespace
-
getNamespaceObject
Get the namespace object that this completeTopicName belongs to.- Specified by:
getNamespaceObjectin interfaceServiceUnitId- Returns:
- namespace object
-
getDomain
public org.apache.pulsar.common.naming.TopicDomain getDomain() -
getTenant
-
getCluster
Deprecated. -
getNamespacePortion
-
getLocalName
-
getEncodedLocalName
-
getPartition
-
getPartitionIndex
public int getPartitionIndex()- Returns:
- partition index of the completeTopicName. It returns -1 if the completeTopicName (topic) is not partitioned.
-
isPartitioned
public boolean isPartitioned() -
getPartitionedTopicName
For partitions in a topic, return the base partitioned topic name. Eg:persistent://prop/cluster/ns/my-topic-partition-1-->persistent://prop/cluster/ns/my-topicpersistent://prop/cluster/ns/my-topic-->persistent://prop/cluster/ns/my-topic
-
getPartitionIndex
- Returns:
- partition index of the completeTopicName. It returns -1 if the completeTopicName (topic) is not partitioned.
-
getRestPath
Returns the http rest path for use in the admin web service. Eg: * "persistent/my-tenant/my-namespace/my-topic" * "non-persistent/my-tenant/my-namespace/my-topic"- Returns:
- topic rest path
-
getRestPath
-
getPersistenceNamingEncoding
Returns the name of the persistence resource associated with the completeTopicName.- Returns:
- the relative path to be used in persistence
-
getLookupName
Get a string suitable for completeTopicName lookup.Example:
persistent://tenant/cluster/namespace/completeTopicName -> persistent/tenant/cluster/namespace/completeTopicName
- Returns:
-
isGlobal
public boolean isGlobal() -
getSchemaName
-
toString
- Specified by:
toStringin interfaceServiceUnitId- Overrides:
toStringin classObject
-
equals
-
hashCode
public int hashCode() -
includes
Description copied from interface:ServiceUnitIdCheck whether a fully-qualified topic is included in thisServiceUnitIdobject.- Specified by:
includesin interfaceServiceUnitId- Parameters:
otherTopicName- a fully-qualified topic object- Returns:
- true or false
-
isV2
public boolean isV2()Returns true if this a V2 topic name prop/ns/topic-name.- Returns:
- true if V2
-