Class NonPersistentTopic
java.lang.Object
org.apache.pulsar.broker.service.AbstractTopic
org.apache.pulsar.broker.service.nonpersistent.NonPersistentTopic
- All Implemented Interfaces:
Topic,TopicPolicyListener
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.pulsar.broker.service.Topic
Topic.PublishContext -
Field Summary
Fields inherited from class org.apache.pulsar.broker.service.AbstractTopic
addEntryLatencyStatsUsec, additionalSystemCursorNames, brokerService, bytesOutFromRemovedSubscriptions, bytesOutFromRemovedSystemSubscriptions, clock, entryFilters, hasBatchMessagePublished, isAllowAutoUpdateSchema, isEncryptionRequired, isFenced, lastActive, lock, msgOutFromRemovedSubscriptions, POLICY_UPDATE_FAILURE_RETRY_TIME_SECONDS, preciseTopicPublishRateLimitingEnable, producers, publishRateLimitedTimes, replicatorPrefix, resourceGroupPublishLimiter, resourceGroupRateLimitingEnabled, topic, topicEpoch, topicPolicies, topicPublishRateLimiter, totalPublishRateLimitedCounter, transferring, userCreatedProducerCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CompletableFuture<Void>addReplicationCluster(String remoteCluster, NonPersistentTopic nonPersistentTopic, String localCluster) addSchemaIfIdleOrCheckCompatible(org.apache.pulsar.common.protocol.schema.SchemaData schema) If the topic is idle (no producers, no entries, no subscribers and no existing schema), add the passed schema to the topic.CompletableFuture<org.apache.pulsar.common.policies.data.stats.NonPersistentTopicStatsImpl>asyncGetStats(boolean getPreciseBacklog, boolean subscriptionBacklogSize, boolean getEarliestTimeInBacklog) CompletableFuture<? extends org.apache.pulsar.common.policies.data.stats.TopicStatsImpl>asyncGetStats(GetStatsOptions getStatsOptions) voidActivate cursors those caught up backlog-threshold entries and deactivate slow cursors which are creating backlog.checkBacklogQuotaExceeded(String producerName, org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType) voidvoidvoidcheckGC()Wait TransactionBuffer recovers completely.voidvoidvoidclose(boolean closeWithoutWaitingClientDisconnect) close(boolean disconnectClients, boolean closeWithoutWaitingClientDisconnect) Close this topic - close all producers and subscriptions associated with this topic.createSubscription(String subscriptionName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, boolean replicateSubscriptionState, Map<String, String> properties) delete()Forcefully close all producers/consumers/replicators and deletes the topic.endTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, int txnAction, long lowWaterMark) End the transaction in this topic.org.apache.pulsar.common.policies.data.BacklogQuotagetBacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType) longUses the best-effort (not necessarily up-to-date) information available to return the age.CompletableFuture<org.apache.pulsar.common.policies.data.PersistentTopicInternalStats>getInternalStats(boolean includeLedgerMetadata) CompletableFuture<org.apache.pulsar.client.api.MessageId>intintgetNumberOfSameAddressConsumers(String clientAddress) getPersistentReplicator(String remoteCluster) Map<String,? extends Replicator> org.apache.pulsar.common.policies.data.stats.NonPersistentTopicStatsImplgetStats(boolean getPreciseBacklog, boolean subscriptionBacklogSize, boolean getEarliestTimeInBacklog) org.apache.pulsar.common.policies.data.stats.TopicStatsImplgetStats(GetStatsOptions getStatsOptions) getSubscription(String subscription) Get OpenTelemetry attribute set.protected CompletableFuture<Long>incrementTopicEpoch(Optional<Long> currentEpoch) booleanisActive()protected booleanbooleanbooleanbooleanbooleanprotected booleanonPoliciesUpdate(org.apache.pulsar.common.policies.data.Policies data) voidonUpdate(org.apache.pulsar.common.policies.data.TopicPolicies data) voidpublishMessage(io.netty.buffer.ByteBuf data, Topic.PublishContext callback) voidpublishTxnMessage(org.apache.pulsar.client.api.transaction.TxnID txnID, io.netty.buffer.ByteBuf headersAndPayload, Topic.PublishContext publishContext) Publish Transaction message to this Topic's TransactionBuffer.protected CompletableFuture<Long>setTopicEpoch(long newEpoch) booleansubscribe(SubscriptionOption option) Subscribe a topic.subscribe(TransportCnx cnx, String subscriptionName, long consumerId, org.apache.pulsar.common.api.proto.CommandSubscribe.SubType subType, int priorityLevel, String consumerName, boolean isDurable, org.apache.pulsar.client.api.MessageId startMessageId, Map<String, String> metadata, boolean readCompacted, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, long resetStartMessageBackInSec, boolean replicateSubscriptionState, org.apache.pulsar.common.api.proto.KeySharedMeta keySharedMeta) truncate()Truncate a topic.unsubscribe(String subscriptionName) voidupdateRates(NamespaceStats nsStats, org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats bundleStats, StatsOutputStream topicStatsStream, ClusterReplicationMetrics replStats, String namespace, boolean hydratePublishers) Methods inherited from class org.apache.pulsar.broker.service.AbstractTopic
addConsumerToSubscription, addFilteredEntriesCount, addProducer, addSchema, checkSchemaCompatibleForConsumer, checkTopicFenced, currentUsageCount, decrementUsageCount, deletePartitionedTopicMetadataWhileInactive, deleteSchema, deleteTopicPolicies, getActiveConsumer, getBrokerPublishRateLimiter, getBrokerService, getBytesInCounter, getBytesOutCounter, getDispatchRate, getEntryFilters, getEntryFiltersPolicy, getFilteredEntriesCount, getHierarchyTopicPolicies, getInactiveTopicPolicies, getMigratedClusterUrl, getMigratedClusterUrl, getMigratedClusterUrlAsync, getMsgInCounter, getMsgOutCounter, getName, getNumberOfSameAddressConsumers, getNumberOfSameAddressProducers, getProducers, getReplicatorDispatchRate, getReplicatorPrefix, getSchemaCompatibilityStrategy, getSchemaId, getSchemaValidationEnforced, getSubscribeRate, getSubscriptionDispatchRate, getSystemTopicBytesInCounter, getTopicPublishRateLimiter, getTotalPublishRateLimitCounter, getWaitingProducersCount, handleConsumerAdded, handleProducerRemoved, hasLocalProducers, hasSchema, increasePublishLimitedTimes, incrementPublishCount, incrementTopicEpochIfNeeded, internalAddProducer, isClusterMigrationEnabled, isConsumersExceededOnTopic, isDeleteWhileInactive, isEncryptionRequired, isExceedMaximumMessageSize, isProducersExceeded, isProducersExceeded, isProducersExceeded, isSameAddressConsumersExceededOnTopic, isSameAddressProducersExceeded, isSystemCursor, isTransferring, markBatchMessagePublished, recordAddLatency, registerTopicPolicyListener, removeProducer, toString, unregisterTopicPolicyListener, updateBrokerDispatchPauseOnAckStatePersistentEnabled, updateBrokerDispatchRate, updateBrokerPublishRate, updateBrokerReplicatorDispatchRate, updateBrokerSubscribeRate, updateBrokerSubscriptionDispatchRate, updateBrokerSubscriptionTypesEnabled, updateDispatchRateLimiter, updateEntryFilters, updatePublishRateLimiter, updateResourceGroupLimiter, updateResourceGroupLimiter, updateTopicPolicy, updateTopicPolicyByNamespacePolicyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pulsar.broker.service.Topic
addProducer, addSchema, checkSchemaCompatibleForConsumer, deleteSchema, getBrokerDispatchRateLimiter, getBrokerService, getDispatchRateLimiter, getEntryFilters, getEntryFiltersPolicy, getHierarchyTopicPolicies, getLastDispatchablePosition, getName, getProducers, getSchemaValidationEnforced, getSubscribeRateLimiter, hasSchema, increasePublishLimitedTimes, incrementPublishCount, isDeduplicationEnabled, isEncryptionRequired, isSystemTopic, isTransferring, recordAddLatency, removeProducer
-
Constructor Details
-
NonPersistentTopic
-
-
Method Details
-
initialize
- Specified by:
initializein interfaceTopic
-
publishMessage
- Specified by:
publishMessagein interfaceTopic
-
incrementTopicEpoch
- Specified by:
incrementTopicEpochin classAbstractTopic
-
setTopicEpoch
- Specified by:
setTopicEpochin classAbstractTopic
-
checkMessageDeduplicationInfo
public void checkMessageDeduplicationInfo()- Specified by:
checkMessageDeduplicationInfoin interfaceTopic
-
shouldProducerMigrate
public boolean shouldProducerMigrate()- Specified by:
shouldProducerMigratein interfaceTopic
-
isReplicationBacklogExist
public boolean isReplicationBacklogExist()- Specified by:
isReplicationBacklogExistin interfaceTopic
-
checkIfTransactionBufferRecoverCompletely
Description copied from interface:TopicWait TransactionBuffer recovers completely.- Specified by:
checkIfTransactionBufferRecoverCompletelyin interfaceTopic- Returns:
- a future that will be completed after the transaction buffer recover completely.
-
subscribe
Description copied from interface:TopicSubscribe a topic. -
createSubscription
public CompletableFuture<Subscription> createSubscription(String subscriptionName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, boolean replicateSubscriptionState, Map<String, String> properties) - Specified by:
createSubscriptionin interfaceTopic
-
delete
-
deleteForcefully
Forcefully close all producers/consumers/replicators and deletes the topic.- Specified by:
deleteForcefullyin interfaceTopic- Returns:
-
close
-
close
public CompletableFuture<Void> close(boolean disconnectClients, boolean closeWithoutWaitingClientDisconnect) Close this topic - close all producers and subscriptions associated with this topic. -
stopReplProducers
-
checkReplication
- Specified by:
checkReplicationin interfaceTopic
-
addReplicationCluster
protected CompletableFuture<Void> addReplicationCluster(String remoteCluster, NonPersistentTopic nonPersistentTopic, String localCluster) -
checkMessageExpiry
public void checkMessageExpiry()- Specified by:
checkMessageExpiryin interfaceTopic
-
getNumberOfConsumers
public int getNumberOfConsumers()- Specified by:
getNumberOfConsumersin classAbstractTopic
-
getNumberOfSameAddressConsumers
- Specified by:
getNumberOfSameAddressConsumersin classAbstractTopic
-
getSubscriptions
- Specified by:
getSubscriptionsin interfaceTopic
-
getReplicators
- Specified by:
getReplicatorsin interfaceTopic
-
getShadowReplicators
- Specified by:
getShadowReplicatorsin interfaceTopic
-
getSubscription
- Specified by:
getSubscriptionin interfaceTopic
-
getPersistentReplicator
-
updateRates
public void updateRates(NamespaceStats nsStats, org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats bundleStats, StatsOutputStream topicStatsStream, ClusterReplicationMetrics replStats, String namespace, boolean hydratePublishers) - Specified by:
updateRatesin interfaceTopic
-
getStats
public org.apache.pulsar.common.policies.data.stats.NonPersistentTopicStatsImpl getStats(boolean getPreciseBacklog, boolean subscriptionBacklogSize, boolean getEarliestTimeInBacklog) -
getStats
public org.apache.pulsar.common.policies.data.stats.TopicStatsImpl getStats(GetStatsOptions getStatsOptions) -
asyncGetStats
public CompletableFuture<org.apache.pulsar.common.policies.data.stats.NonPersistentTopicStatsImpl> asyncGetStats(boolean getPreciseBacklog, boolean subscriptionBacklogSize, boolean getEarliestTimeInBacklog) - Specified by:
asyncGetStatsin interfaceTopic
-
asyncGetStats
public CompletableFuture<? extends org.apache.pulsar.common.policies.data.stats.TopicStatsImpl> asyncGetStats(GetStatsOptions getStatsOptions) - Specified by:
asyncGetStatsin interfaceTopic
-
getInternalStats
public CompletableFuture<org.apache.pulsar.common.policies.data.PersistentTopicInternalStats> getInternalStats(boolean includeLedgerMetadata) - Specified by:
getInternalStatsin interfaceTopic
-
isActive
public boolean isActive() -
checkClusterMigration
- Specified by:
checkClusterMigrationin interfaceTopic
-
checkGC
public void checkGC() -
checkInactiveSubscriptions
public void checkInactiveSubscriptions()- Specified by:
checkInactiveSubscriptionsin interfaceTopic
-
checkBackloggedCursors
public void checkBackloggedCursors()Description copied from interface:TopicActivate cursors those caught up backlog-threshold entries and deactivate slow cursors which are creating backlog.- Specified by:
checkBackloggedCursorsin interfaceTopic
-
checkCursorsToCacheEntries
public void checkCursorsToCacheEntries()- Specified by:
checkCursorsToCacheEntriesin interfaceTopic
-
checkDeduplicationSnapshot
public void checkDeduplicationSnapshot()- Specified by:
checkDeduplicationSnapshotin interfaceTopic
-
onPoliciesUpdate
public CompletableFuture<Void> onPoliciesUpdate(org.apache.pulsar.common.policies.data.Policies data) - Specified by:
onPoliciesUpdatein interfaceTopic
-
onUpdate
public void onUpdate(org.apache.pulsar.common.policies.data.TopicPolicies data) - Specified by:
onUpdatein interfaceTopicPolicyListener
-
getBacklogQuota
public org.apache.pulsar.common.policies.data.BacklogQuota getBacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType) - Specified by:
getBacklogQuotain interfaceTopic- Returns:
- Backlog quota for topic
-
checkBacklogQuotaExceeded
public CompletableFuture<Void> checkBacklogQuotaExceeded(String producerName, org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType) - Specified by:
checkBacklogQuotaExceededin interfaceTopic- Returns:
- quota exceeded status for blocking producer creation
-
isReplicated
public boolean isReplicated()- Specified by:
isReplicatedin interfaceTopic
-
isShadowReplicated
public boolean isShadowReplicated()- Specified by:
isShadowReplicatedin interfaceTopic
-
unsubscribe
- Specified by:
unsubscribein interfaceTopic
-
getLastPosition
- Specified by:
getLastPositionin interfaceTopic
-
getLastMessageId
- Specified by:
getLastMessageIdin interfaceTopic
-
addSchemaIfIdleOrCheckCompatible
public CompletableFuture<Void> addSchemaIfIdleOrCheckCompatible(org.apache.pulsar.common.protocol.schema.SchemaData schema) Description copied from interface:TopicIf the topic is idle (no producers, no entries, no subscribers and no existing schema), add the passed schema to the topic. Otherwise, check that the passed schema is compatible with what the topic already has.- Specified by:
addSchemaIfIdleOrCheckCompatiblein interfaceTopic
-
publishTxnMessage
public void publishTxnMessage(org.apache.pulsar.client.api.transaction.TxnID txnID, io.netty.buffer.ByteBuf headersAndPayload, Topic.PublishContext publishContext) Description copied from interface:TopicPublish Transaction message to this Topic's TransactionBuffer.- Specified by:
publishTxnMessagein interfaceTopic- Parameters:
txnID- Transaction IdheadersAndPayload- Message datapublishContext- Publish context
-
endTxn
public CompletableFuture<Void> endTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, int txnAction, long lowWaterMark) Description copied from interface:TopicEnd the transaction in this topic. -
truncate
Description copied from interface:TopicTruncate a topic. The truncate operation will move all cursors to the end of the topic and delete all inactive ledgers. -
isTerminated
protected boolean isTerminated()- Specified by:
isTerminatedin classAbstractTopic
-
isMigrated
protected boolean isMigrated()- Specified by:
isMigratedin classAbstractTopic
-
isPersistent
public boolean isPersistent()- Specified by:
isPersistentin interfaceTopic
-
getBestEffortOldestUnacknowledgedMessageAgeSeconds
public long getBestEffortOldestUnacknowledgedMessageAgeSeconds()Description copied from interface:TopicUses the best-effort (not necessarily up-to-date) information available to return the age.- Specified by:
getBestEffortOldestUnacknowledgedMessageAgeSecondsin interfaceTopic- Returns:
- The oldest unacknowledged message age in seconds, or -1 if not available
-
getTopicAttributes
Description copied from interface:TopicGet OpenTelemetry attribute set.- Specified by:
getTopicAttributesin interfaceTopic- Returns:
-