Class PersistentTopic
- java.lang.Object
-
- org.apache.pulsar.broker.service.AbstractTopic
-
- org.apache.pulsar.broker.service.persistent.PersistentTopic
-
- All Implemented Interfaces:
org.apache.bookkeeper.mledger.AsyncCallbacks.AddEntryCallback,Topic,TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies>
- Direct Known Subclasses:
SystemTopic
public class PersistentTopic extends AbstractTopic implements Topic, org.apache.bookkeeper.mledger.AsyncCallbacks.AddEntryCallback, TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pulsar.broker.service.Topic
Topic.PublishContext
-
-
Field Summary
Fields Modifier and Type Field Description booleandelayedDeliveryEnabledlongdelayedDeliveryTickTimeMillisprotected org.apache.bookkeeper.mledger.ManagedLedgerledgerstatic intMESSAGE_RATE_BACKOFF_MSprotected MessageDeduplicationmessageDeduplicationbooleanmsgChunkPublishedprotected TransactionBuffertransactionBuffer-
Fields inherited from class org.apache.pulsar.broker.service.AbstractTopic
addEntryLatencyStatsUsec, brokerService, bytesOutFromRemovedSubscriptions, hasBatchMessagePublished, inactiveTopicPolicies, isAllowAutoUpdateSchema, isEncryptionRequired, isFenced, lastActive, lock, maxSubscriptionsPerTopic, maxUnackedMessagesOnConsumerAppilied, msgOutFromRemovedSubscriptions, preciseTopicPublishRateLimitingEnable, producers, publishRateLimitedTimes, replicatorPrefix, resourceGroupPublishLimiter, resourceGroupRateLimitingEnabled, schemaCompatibilityStrategy, schemaValidationEnforced, topic, topicEpoch, topicPublishRateLimiter
-
-
Constructor Summary
Constructors Constructor Description PersistentTopic(java.lang.String topic, org.apache.bookkeeper.mledger.ManagedLedger ledger, BrokerService brokerService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComplete(org.apache.bookkeeper.mledger.Position pos, io.netty.buffer.ByteBuf entryData, java.lang.Object ctx)voidaddFailed(org.apache.bookkeeper.mledger.ManagedLedgerException exception, java.lang.Object ctx)java.util.concurrent.CompletableFuture<java.util.Optional<java.lang.Long>>addProducer(Producer producer, java.util.concurrent.CompletableFuture<java.lang.Void> producerQueuedFuture)Tries to add a producer to the topic.protected java.util.concurrent.CompletableFuture<java.lang.Void>addReplicationCluster(java.lang.String remoteCluster, org.apache.bookkeeper.mledger.ManagedCursor cursor, java.lang.String localCluster)java.util.concurrent.CompletableFuture<java.lang.Void>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.voidasyncReadEntry(org.apache.bookkeeper.mledger.impl.PositionImpl position, org.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntryCallback callback, java.lang.Object ctx)voidcheckBackloggedCursors()Activate cursors those caught up backlog-threshold entries and deactivate slow cursors which are creating backlog.voidcheckCompaction()voidcheckDeduplicationSnapshot()java.util.concurrent.CompletableFuture<java.lang.Void>checkDeduplicationStatus()voidcheckGC()java.util.concurrent.CompletableFuture<java.lang.Void>checkIfTransactionBufferRecoverCompletely(boolean isTxnEnabled)Wait TransactionBuffer Recovers completely.voidcheckInactiveSubscriptions()voidcheckMessageDeduplicationInfo()voidcheckMessageExpiry()voidcheckReplicatedSubscriptionControllerState()java.util.concurrent.CompletableFuture<java.lang.Void>checkReplication()booleancheckSubscriptionTypesEnable(org.apache.pulsar.common.api.proto.CommandSubscribe.SubType subType)java.util.concurrent.CompletableFuture<java.lang.Void>clearBacklog()Clears backlog for all cursors in the topic.java.util.concurrent.CompletableFuture<java.lang.Void>clearBacklog(java.lang.String cursorName)Clears backlog for a given cursor in the topic.java.util.concurrent.CompletableFuture<java.lang.Void>close()java.util.concurrent.CompletableFuture<java.lang.Void>close(boolean closeWithoutWaitingClientDisconnect)Close this topic - close all producers and subscriptions associated with this topic.org.apache.pulsar.client.admin.LongRunningProcessStatuscompactionStatus()java.util.concurrent.CompletableFuture<Subscription>createSubscription(java.lang.String subscriptionName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, boolean replicateSubscriptionState)java.util.concurrent.CompletableFuture<java.lang.Void>delete()Delete the managed ledger associated with this topic.java.util.concurrent.CompletableFuture<java.lang.Void>deleteForcefully()Forcefully close all producers/consumers/replicators and deletes the topic.java.util.concurrent.CompletableFuture<java.lang.Void>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)longgetBacklogSize()CompactedTopicgetCompactedTopic()java.util.Optional<CompactedTopicContext>getCompactedTopicContext()longgetDelayedDeliveryTickTimeMillis()java.util.Optional<DispatchRateLimiter>getDispatchRateLimiter()org.apache.bookkeeper.mledger.impl.PositionImplgetFirstPosition()java.util.concurrent.CompletableFuture<org.apache.pulsar.common.policies.data.PersistentTopicInternalStats>getInternalStats(boolean includeLedgerMetadata)longgetLastDataMessagePublishedTimestamp()java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.MessageId>getLastMessageId()org.apache.bookkeeper.mledger.PositiongetLastPosition()longgetLastPublishedSequenceId(java.lang.String producerName)doublegetLastUpdatedAvgPublishRateInByte()doublegetLastUpdatedAvgPublishRateInMsg()org.apache.bookkeeper.mledger.ManagedLedgergetManagedLedger()org.apache.bookkeeper.mledger.impl.PositionImplgetMaxReadPosition()intgetMaxUnackedMessagesOnConsumer()intgetMaxUnackedMessagesOnSubscription()MessageDeduplicationgetMessageDeduplication()intgetNumberOfConsumers()longgetNumberOfEntries()intgetNumberOfSameAddressConsumers(java.lang.String clientAddress)java.util.concurrent.CompletableFuture<org.apache.bookkeeper.mledger.ManagedLedger>getPendingAckManagedLedger(java.lang.String subName)ReplicatorgetPersistentReplicator(java.lang.String remoteCluster)org.apache.bookkeeper.mledger.impl.PositionImplgetPositionAfterN(org.apache.bookkeeper.mledger.impl.PositionImpl startPosition, long n)java.util.Optional<ReplicatedSubscriptionsController>getReplicatedSubscriptionController()org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap<java.lang.String,Replicator>getReplicators()org.apache.pulsar.common.policies.data.stats.TopicStatsImplgetStats(boolean getPreciseBacklog, boolean subscriptionBacklogSize)java.util.Optional<SubscribeRateLimiter>getSubscribeRateLimiter()PersistentSubscriptiongetSubscription(java.lang.String subscriptionName)org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap<java.lang.String,PersistentSubscription>getSubscriptions()org.apache.pulsar.common.policies.data.TransactionBufferStatsgetTransactionBufferStats()org.apache.pulsar.common.policies.data.TransactionInBufferStatsgetTransactionInBufferStats(org.apache.pulsar.client.api.transaction.TxnID txnID)org.apache.pulsar.common.policies.data.TransactionInPendingAckStatsgetTransactionInPendingAckStats(org.apache.pulsar.client.api.transaction.TxnID txnID, java.lang.String subName)org.apache.pulsar.common.policies.data.TransactionPendingAckStatsgetTransactionPendingAckStats(java.lang.String subName)protected voidhandleProducerRemoved(Producer producer)protected java.util.concurrent.CompletableFuture<java.lang.Long>incrementTopicEpoch(java.util.Optional<java.lang.Long> currentEpoch)java.util.concurrent.CompletableFuture<java.lang.Void>initialize()protected java.util.concurrent.CompletableFuture<java.lang.Void>initTopicPolicy()booleanisActive(org.apache.pulsar.common.policies.data.InactiveTopicDeleteMode deleteMode)booleanisBacklogQuotaExceeded(java.lang.String producerName, org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType)java.util.concurrent.CompletableFuture<java.lang.Boolean>isCompactionEnabled()booleanisDeduplicationEnabled()booleanisDelayedDeliveryEnabled()booleanisOldestMessageExpired(org.apache.bookkeeper.mledger.ManagedCursor cursor, int messageTTLInSeconds)booleanisPersistent()booleanisReplicated()booleanisSizeBacklogExceeded()booleanisSystemTopic()protected booleanisTerminated()booleanisTimeBacklogExceeded()booleanisTxnAborted(org.apache.pulsar.client.api.transaction.TxnID txnID)org.apache.pulsar.client.admin.OffloadProcessStatusoffloadStatus()java.util.concurrent.CompletableFuture<java.lang.Void>onPoliciesUpdate(org.apache.pulsar.common.policies.data.Policies data)voidonUpdate(org.apache.pulsar.common.policies.data.TopicPolicies policies)java.util.concurrent.CompletableFuture<java.lang.Void>preCreateSubscriptionForCompactionIfNeeded()voidpublishMessage(io.netty.buffer.ByteBuf headersAndPayload, Topic.PublishContext publishContext)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 java.util.concurrent.CompletableFuture<java.lang.Long>setTopicEpoch(long newEpoch)java.util.concurrent.CompletableFuture<java.lang.Void>startReplProducers()java.util.concurrent.CompletableFuture<java.lang.Void>stopReplProducers()java.util.concurrent.CompletableFuture<Consumer>subscribe(TransportCnx cnx, java.lang.String subscriptionName, long consumerId, org.apache.pulsar.common.api.proto.CommandSubscribe.SubType subType, int priorityLevel, java.lang.String consumerName, boolean isDurable, org.apache.pulsar.client.api.MessageId startMessageId, java.util.Map<java.lang.String,java.lang.String> metadata, boolean readCompacted, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, long startMessageRollbackDurationSec, boolean replicatedSubscriptionStateArg, org.apache.pulsar.common.api.proto.KeySharedMeta keySharedMeta)java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.MessageId>terminate()voidtriggerCompaction()voidtriggerOffload(org.apache.pulsar.client.impl.MessageIdImpl messageId)java.util.concurrent.CompletableFuture<java.lang.Void>truncate()Truncate a topic.java.util.concurrent.CompletableFuture<java.lang.Void>unsubscribe(java.lang.String subscriptionName)Delete the cursor ledger for a given subscription.voidupdateRates(NamespaceStats nsStats, org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats bundleStats, StatsOutputStream topicStatsStream, ClusterReplicationMetrics replStats, java.lang.String namespace, boolean hydratePublishers)voidupdateUnackedMessagesAppliedOnSubscription(org.apache.pulsar.common.policies.data.Policies policies)-
Methods inherited from class org.apache.pulsar.broker.service.AbstractTopic
addConsumerToSubscription, addSchema, checkSchemaCompatibleForConsumer, checkTopicFenced, checkTopicPublishThrottlingRate, currentUsageCount, decrementUsageCount, deletePartitionedTopicMetadataWhileInactive, deleteSchema, deleteTopicPolicies, disableCnxAutoRead, disableProducerRead, enableCnxAutoRead, enableProducerReadForPublishBufferLimiting, enableProducerReadForPublishRateLimiting, getActiveConsumer, getBrokerPublishRateLimiter, getBrokerService, getBytesInCounter, getBytesOutCounter, getInactiveTopicPolicies, getMsgInCounter, getMsgOutCounter, getName, getNumberOfSameAddressConsumers, getNumberOfSameAddressProducers, getProducers, getReplicatorPrefix, getSchemaValidationEnforced, getTopicPolicies, getTopicPublishRateLimiter, getWaitingProducersCount, handleConsumerAdded, hasLocalProducers, hasSchema, increasePublishLimitedTimes, incrementPublishCount, incrementTopicEpochIfNeeded, internalAddProducer, isBrokerPublishRateExceeded, isConsumersExceededOnTopic, isDeleteWhileInactive, isEncryptionRequired, isExceedMaximumMessageSize, isProducersExceeded, isPublishRateExceeded, isResourceGroupPublishRateExceeded, isResourceGroupRateLimitingEnabled, isSameAddressConsumersExceededOnTopic, isSameAddressProducersExceeded, isTopicPublishRateExceeded, markBatchMessagePublished, recordAddLatency, removeProducer, resetBrokerPublishCountAndEnableReadIfRequired, resetInactiveTopicPolicies, resetTopicPublishCountAndEnableReadIfRequired, setDeleteWhileInactive, setSchemaCompatibilityStrategy, toString, updateMaxPublishRate, updatePublishDispatcher
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.pulsar.broker.service.Topic
addSchema, checkSchemaCompatibleForConsumer, checkTopicPublishThrottlingRate, deleteSchema, disableCnxAutoRead, enableCnxAutoRead, getBrokerService, getName, getProducers, getSchemaValidationEnforced, hasSchema, increasePublishLimitedTimes, incrementPublishCount, isBrokerPublishRateExceeded, isEncryptionRequired, isPublishRateExceeded, isResourceGroupPublishRateExceeded, isResourceGroupRateLimitingEnabled, isTopicPublishRateExceeded, recordAddLatency, removeProducer, resetBrokerPublishCountAndEnableReadIfRequired, resetTopicPublishCountAndEnableReadIfRequired
-
-
-
-
Field Detail
-
ledger
protected final org.apache.bookkeeper.mledger.ManagedLedger ledger
-
msgChunkPublished
public boolean msgChunkPublished
-
delayedDeliveryTickTimeMillis
public volatile long delayedDeliveryTickTimeMillis
-
delayedDeliveryEnabled
public volatile boolean delayedDeliveryEnabled
-
MESSAGE_RATE_BACKOFF_MS
public static final int MESSAGE_RATE_BACKOFF_MS
- See Also:
- Constant Field Values
-
messageDeduplication
protected final MessageDeduplication messageDeduplication
-
transactionBuffer
protected final TransactionBuffer transactionBuffer
-
-
Constructor Detail
-
PersistentTopic
public PersistentTopic(java.lang.String topic, org.apache.bookkeeper.mledger.ManagedLedger ledger, BrokerService brokerService)
-
-
Method Detail
-
initialize
public java.util.concurrent.CompletableFuture<java.lang.Void> initialize()
- Specified by:
initializein interfaceTopic
-
publishMessage
public void publishMessage(io.netty.buffer.ByteBuf headersAndPayload, Topic.PublishContext publishContext)- Specified by:
publishMessagein interfaceTopic
-
asyncReadEntry
public void asyncReadEntry(org.apache.bookkeeper.mledger.impl.PositionImpl position, org.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntryCallback callback, java.lang.Object ctx)
-
getPositionAfterN
public org.apache.bookkeeper.mledger.impl.PositionImpl getPositionAfterN(org.apache.bookkeeper.mledger.impl.PositionImpl startPosition, long n) throws org.apache.bookkeeper.mledger.ManagedLedgerException- Throws:
org.apache.bookkeeper.mledger.ManagedLedgerException
-
getFirstPosition
public org.apache.bookkeeper.mledger.impl.PositionImpl getFirstPosition() throws org.apache.bookkeeper.mledger.ManagedLedgerException- Throws:
org.apache.bookkeeper.mledger.ManagedLedgerException
-
getNumberOfEntries
public long getNumberOfEntries()
-
addComplete
public void addComplete(org.apache.bookkeeper.mledger.Position pos, io.netty.buffer.ByteBuf entryData, java.lang.Object ctx)- Specified by:
addCompletein interfaceorg.apache.bookkeeper.mledger.AsyncCallbacks.AddEntryCallback
-
addFailed
public void addFailed(org.apache.bookkeeper.mledger.ManagedLedgerException exception, java.lang.Object ctx)- Specified by:
addFailedin interfaceorg.apache.bookkeeper.mledger.AsyncCallbacks.AddEntryCallback
-
addProducer
public java.util.concurrent.CompletableFuture<java.util.Optional<java.lang.Long>> addProducer(Producer producer, java.util.concurrent.CompletableFuture<java.lang.Void> producerQueuedFuture)
Description copied from interface:TopicTries to add a producer to the topic. Several validations will be performed.- Specified by:
addProducerin interfaceTopic- Overrides:
addProducerin classAbstractTopicproducerQueuedFuture- a future that will be triggered if the producer is being queued up prior of getting established- Returns:
- the "topic epoch" if there is one or empty
-
checkIfTransactionBufferRecoverCompletely
public java.util.concurrent.CompletableFuture<java.lang.Void> checkIfTransactionBufferRecoverCompletely(boolean isTxnEnabled)
Description copied from interface:TopicWait TransactionBuffer Recovers completely. Take snapshot after TB Recovers completely.- Specified by:
checkIfTransactionBufferRecoverCompletelyin interfaceTopic- Returns:
- a future which has completely if isTxn = false. Or a future return by takeSnapshot.
-
incrementTopicEpoch
protected java.util.concurrent.CompletableFuture<java.lang.Long> incrementTopicEpoch(java.util.Optional<java.lang.Long> currentEpoch)
- Specified by:
incrementTopicEpochin classAbstractTopic
-
setTopicEpoch
protected java.util.concurrent.CompletableFuture<java.lang.Long> setTopicEpoch(long newEpoch)
- Specified by:
setTopicEpochin classAbstractTopic
-
startReplProducers
public java.util.concurrent.CompletableFuture<java.lang.Void> startReplProducers()
-
stopReplProducers
public java.util.concurrent.CompletableFuture<java.lang.Void> stopReplProducers()
-
handleProducerRemoved
protected void handleProducerRemoved(Producer producer)
- Overrides:
handleProducerRemovedin classAbstractTopic
-
subscribe
public java.util.concurrent.CompletableFuture<Consumer> subscribe(TransportCnx cnx, java.lang.String subscriptionName, long consumerId, org.apache.pulsar.common.api.proto.CommandSubscribe.SubType subType, int priorityLevel, java.lang.String consumerName, boolean isDurable, org.apache.pulsar.client.api.MessageId startMessageId, java.util.Map<java.lang.String,java.lang.String> metadata, boolean readCompacted, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, long startMessageRollbackDurationSec, boolean replicatedSubscriptionStateArg, org.apache.pulsar.common.api.proto.KeySharedMeta keySharedMeta)
-
updateUnackedMessagesAppliedOnSubscription
public void updateUnackedMessagesAppliedOnSubscription(org.apache.pulsar.common.policies.data.Policies policies)
-
createSubscription
public java.util.concurrent.CompletableFuture<Subscription> createSubscription(java.lang.String subscriptionName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, boolean replicateSubscriptionState)
- Specified by:
createSubscriptionin interfaceTopic
-
unsubscribe
public java.util.concurrent.CompletableFuture<java.lang.Void> unsubscribe(java.lang.String subscriptionName)
Delete the cursor ledger for a given subscription.- Specified by:
unsubscribein interfaceTopic- Parameters:
subscriptionName- Subscription for which the cursor ledger is to be deleted- Returns:
- Completable future indicating completion of unsubscribe operation Completed exceptionally with: ManagedLedgerException if cursor ledger delete fails
-
delete
public java.util.concurrent.CompletableFuture<java.lang.Void> delete()
Delete the managed ledger associated with this topic.
-
deleteForcefully
public java.util.concurrent.CompletableFuture<java.lang.Void> deleteForcefully()
Forcefully close all producers/consumers/replicators and deletes the topic. this function is used when local cluster is removed from global-namespace replication list. Because broker doesn't allow lookup if local cluster is not part of replication cluster list.- Specified by:
deleteForcefullyin interfaceTopic- Returns:
-
close
public java.util.concurrent.CompletableFuture<java.lang.Void> close()
-
close
public java.util.concurrent.CompletableFuture<java.lang.Void> close(boolean closeWithoutWaitingClientDisconnect)
Close this topic - close all producers and subscriptions associated with this topic.
-
checkDeduplicationStatus
public java.util.concurrent.CompletableFuture<java.lang.Void> checkDeduplicationStatus()
-
checkReplication
public java.util.concurrent.CompletableFuture<java.lang.Void> checkReplication()
- Specified by:
checkReplicationin interfaceTopic
-
checkMessageExpiry
public void checkMessageExpiry()
- Specified by:
checkMessageExpiryin interfaceTopic
-
checkMessageDeduplicationInfo
public void checkMessageDeduplicationInfo()
- Specified by:
checkMessageDeduplicationInfoin interfaceTopic
-
isCompactionEnabled
public java.util.concurrent.CompletableFuture<java.lang.Boolean> isCompactionEnabled()
-
checkCompaction
public void checkCompaction()
-
preCreateSubscriptionForCompactionIfNeeded
public java.util.concurrent.CompletableFuture<java.lang.Void> preCreateSubscriptionForCompactionIfNeeded()
-
addReplicationCluster
protected java.util.concurrent.CompletableFuture<java.lang.Void> addReplicationCluster(java.lang.String remoteCluster, org.apache.bookkeeper.mledger.ManagedCursor cursor, java.lang.String localCluster)
-
isDeduplicationEnabled
public boolean isDeduplicationEnabled()
-
getNumberOfConsumers
public int getNumberOfConsumers()
- Specified by:
getNumberOfConsumersin classAbstractTopic
-
getNumberOfSameAddressConsumers
public int getNumberOfSameAddressConsumers(java.lang.String clientAddress)
- Specified by:
getNumberOfSameAddressConsumersin classAbstractTopic
-
getSubscriptions
public org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap<java.lang.String,PersistentSubscription> getSubscriptions()
- Specified by:
getSubscriptionsin interfaceTopic
-
getSubscription
public PersistentSubscription getSubscription(java.lang.String subscriptionName)
- Specified by:
getSubscriptionin interfaceTopic
-
getReplicators
public org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap<java.lang.String,Replicator> getReplicators()
- Specified by:
getReplicatorsin interfaceTopic
-
getPersistentReplicator
public Replicator getPersistentReplicator(java.lang.String remoteCluster)
-
getManagedLedger
public org.apache.bookkeeper.mledger.ManagedLedger getManagedLedger()
-
updateRates
public void updateRates(NamespaceStats nsStats, org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats bundleStats, StatsOutputStream topicStatsStream, ClusterReplicationMetrics replStats, java.lang.String namespace, boolean hydratePublishers)
- Specified by:
updateRatesin interfaceTopic
-
getLastUpdatedAvgPublishRateInMsg
public double getLastUpdatedAvgPublishRateInMsg()
-
getLastUpdatedAvgPublishRateInByte
public double getLastUpdatedAvgPublishRateInByte()
-
getStats
public org.apache.pulsar.common.policies.data.stats.TopicStatsImpl getStats(boolean getPreciseBacklog, boolean subscriptionBacklogSize)
-
getInternalStats
public java.util.concurrent.CompletableFuture<org.apache.pulsar.common.policies.data.PersistentTopicInternalStats> getInternalStats(boolean includeLedgerMetadata)
- Specified by:
getInternalStatsin interfaceTopic
-
getCompactedTopicContext
public java.util.Optional<CompactedTopicContext> getCompactedTopicContext()
-
getBacklogSize
public long getBacklogSize()
-
isActive
public boolean isActive(org.apache.pulsar.common.policies.data.InactiveTopicDeleteMode deleteMode)
-
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
-
checkDeduplicationSnapshot
public void checkDeduplicationSnapshot()
- Specified by:
checkDeduplicationSnapshotin interfaceTopic
-
onPoliciesUpdate
public java.util.concurrent.CompletableFuture<java.lang.Void> onPoliciesUpdate(org.apache.pulsar.common.policies.data.Policies data)
- Specified by:
onPoliciesUpdatein interfaceTopic
-
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
-
isBacklogQuotaExceeded
public boolean isBacklogQuotaExceeded(java.lang.String producerName, org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType)- Specified by:
isBacklogQuotaExceededin interfaceTopic- Returns:
- quota exceeded status for blocking producer creation
-
isSizeBacklogExceeded
public boolean isSizeBacklogExceeded()
- Returns:
- determine if backlog quota enforcement needs to be done for topic based on size limit
-
isTimeBacklogExceeded
public boolean isTimeBacklogExceeded()
- Returns:
- determine if backlog quota enforcement needs to be done for topic based on time limit
-
isReplicated
public boolean isReplicated()
- Specified by:
isReplicatedin interfaceTopic
-
terminate
public java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.MessageId> terminate()
-
isOldestMessageExpired
public boolean isOldestMessageExpired(org.apache.bookkeeper.mledger.ManagedCursor cursor, int messageTTLInSeconds)
-
clearBacklog
public java.util.concurrent.CompletableFuture<java.lang.Void> clearBacklog()
Clears backlog for all cursors in the topic.- Returns:
-
clearBacklog
public java.util.concurrent.CompletableFuture<java.lang.Void> clearBacklog(java.lang.String cursorName)
Clears backlog for a given cursor in the topic.Note: For a replication cursor, just provide the remote cluster name
- Parameters:
cursorName-- Returns:
-
getDispatchRateLimiter
public java.util.Optional<DispatchRateLimiter> getDispatchRateLimiter()
- Specified by:
getDispatchRateLimiterin interfaceTopic
-
getSubscribeRateLimiter
public java.util.Optional<SubscribeRateLimiter> getSubscribeRateLimiter()
-
getLastPublishedSequenceId
public long getLastPublishedSequenceId(java.lang.String producerName)
-
getLastPosition
public org.apache.bookkeeper.mledger.Position getLastPosition()
- Specified by:
getLastPositionin interfaceTopic
-
getLastMessageId
public java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.MessageId> getLastMessageId()
- Specified by:
getLastMessageIdin interfaceTopic
-
triggerCompaction
public void triggerCompaction() throws org.apache.pulsar.broker.PulsarServerException, BrokerServiceException.AlreadyRunningException- Throws:
org.apache.pulsar.broker.PulsarServerExceptionBrokerServiceException.AlreadyRunningException
-
compactionStatus
public org.apache.pulsar.client.admin.LongRunningProcessStatus compactionStatus()
-
triggerOffload
public void triggerOffload(org.apache.pulsar.client.impl.MessageIdImpl messageId) throws BrokerServiceException.AlreadyRunningException
-
offloadStatus
public org.apache.pulsar.client.admin.OffloadProcessStatus offloadStatus()
-
addSchemaIfIdleOrCheckCompatible
public java.util.concurrent.CompletableFuture<java.lang.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
-
checkReplicatedSubscriptionControllerState
public void checkReplicatedSubscriptionControllerState()
-
getReplicatedSubscriptionController
public java.util.Optional<ReplicatedSubscriptionsController> getReplicatedSubscriptionController()
-
getCompactedTopic
public CompactedTopic getCompactedTopic()
-
isSystemTopic
public boolean isSystemTopic()
- Specified by:
isSystemTopicin interfaceTopic
-
isPersistent
public boolean isPersistent()
- Specified by:
isPersistentin 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 java.util.concurrent.CompletableFuture<java.lang.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
public java.util.concurrent.CompletableFuture<java.lang.Void> 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.
-
getDelayedDeliveryTickTimeMillis
public long getDelayedDeliveryTickTimeMillis()
-
getMaxUnackedMessagesOnConsumer
public int getMaxUnackedMessagesOnConsumer()
-
isDelayedDeliveryEnabled
public boolean isDelayedDeliveryEnabled()
-
getMaxUnackedMessagesOnSubscription
public int getMaxUnackedMessagesOnSubscription()
-
onUpdate
public void onUpdate(org.apache.pulsar.common.policies.data.TopicPolicies policies)
- Specified by:
onUpdatein interfaceTopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies>
-
initTopicPolicy
protected java.util.concurrent.CompletableFuture<java.lang.Void> initTopicPolicy()
-
getMessageDeduplication
public MessageDeduplication getMessageDeduplication()
-
checkSubscriptionTypesEnable
public boolean checkSubscriptionTypesEnable(org.apache.pulsar.common.api.proto.CommandSubscribe.SubType subType) throws java.lang.Exception- Throws:
java.lang.Exception
-
getTransactionBufferStats
public org.apache.pulsar.common.policies.data.TransactionBufferStats getTransactionBufferStats()
-
getTransactionPendingAckStats
public org.apache.pulsar.common.policies.data.TransactionPendingAckStats getTransactionPendingAckStats(java.lang.String subName)
-
getMaxReadPosition
public org.apache.bookkeeper.mledger.impl.PositionImpl getMaxReadPosition()
-
isTxnAborted
public boolean isTxnAborted(org.apache.pulsar.client.api.transaction.TxnID txnID)
-
getTransactionInBufferStats
public org.apache.pulsar.common.policies.data.TransactionInBufferStats getTransactionInBufferStats(org.apache.pulsar.client.api.transaction.TxnID txnID)
-
isTerminated
protected boolean isTerminated()
- Specified by:
isTerminatedin classAbstractTopic
-
getTransactionInPendingAckStats
public org.apache.pulsar.common.policies.data.TransactionInPendingAckStats getTransactionInPendingAckStats(org.apache.pulsar.client.api.transaction.TxnID txnID, java.lang.String subName)
-
getPendingAckManagedLedger
public java.util.concurrent.CompletableFuture<org.apache.bookkeeper.mledger.ManagedLedger> getPendingAckManagedLedger(java.lang.String subName)
-
getLastDataMessagePublishedTimestamp
public long getLastDataMessagePublishedTimestamp()
-
-