Interface Topic

    • Method Detail

      • initialize

        java.util.concurrent.CompletableFuture<java.lang.Void> initialize()
      • publishMessage

        void publishMessage​(io.netty.buffer.ByteBuf headersAndPayload,
                            Topic.PublishContext callback)
      • addProducer

        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. Several validations will be performed.
        Parameters:
        producer -
        producerQueuedFuture - 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
      • removeProducer

        void removeProducer​(Producer producer)
      • checkIfTransactionBufferRecoverCompletely

        java.util.concurrent.CompletableFuture<java.lang.Void> checkIfTransactionBufferRecoverCompletely​(boolean isTxnEnabled)
        Wait TransactionBuffer Recovers completely. Take snapshot after TB Recovers completely.
        Parameters:
        isTxnEnabled -
        Returns:
        a future which has completely if isTxn = false. Or a future return by takeSnapshot.
      • recordAddLatency

        void recordAddLatency​(long latency,
                              java.util.concurrent.TimeUnit unit)
        record add-latency.
      • increasePublishLimitedTimes

        long increasePublishLimitedTimes()
        increase the publishing limited times.
      • subscribe

        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 replicateSubscriptionState,
                                                                   org.apache.pulsar.common.api.proto.KeySharedMeta keySharedMeta)
      • createSubscription

        java.util.concurrent.CompletableFuture<Subscription> createSubscription​(java.lang.String subscriptionName,
                                                                                org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition,
                                                                                boolean replicateSubscriptionState)
      • unsubscribe

        java.util.concurrent.CompletableFuture<java.lang.Void> unsubscribe​(java.lang.String subName)
      • getSubscriptions

        org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap<java.lang.String,​? extends Subscription> getSubscriptions()
      • delete

        java.util.concurrent.CompletableFuture<java.lang.Void> delete()
      • getProducers

        java.util.Map<java.lang.String,​Producer> getProducers()
      • getName

        java.lang.String getName()
      • checkReplication

        java.util.concurrent.CompletableFuture<java.lang.Void> checkReplication()
      • close

        java.util.concurrent.CompletableFuture<java.lang.Void> close​(boolean closeWithoutWaitingClientDisconnect)
      • checkGC

        void checkGC()
      • checkInactiveSubscriptions

        void checkInactiveSubscriptions()
      • checkBackloggedCursors

        void checkBackloggedCursors()
        Activate cursors those caught up backlog-threshold entries and deactivate slow cursors which are creating backlog.
      • checkDeduplicationSnapshot

        void checkDeduplicationSnapshot()
      • checkMessageExpiry

        void checkMessageExpiry()
      • checkMessageDeduplicationInfo

        void checkMessageDeduplicationInfo()
      • checkTopicPublishThrottlingRate

        void checkTopicPublishThrottlingRate()
      • incrementPublishCount

        void incrementPublishCount​(int numOfMessages,
                                   long msgSizeInBytes)
      • resetTopicPublishCountAndEnableReadIfRequired

        void resetTopicPublishCountAndEnableReadIfRequired()
      • resetBrokerPublishCountAndEnableReadIfRequired

        void resetBrokerPublishCountAndEnableReadIfRequired​(boolean doneReset)
      • isPublishRateExceeded

        boolean isPublishRateExceeded()
      • isTopicPublishRateExceeded

        boolean isTopicPublishRateExceeded​(int msgSize,
                                           int numMessages)
      • isResourceGroupRateLimitingEnabled

        boolean isResourceGroupRateLimitingEnabled()
      • isResourceGroupPublishRateExceeded

        boolean isResourceGroupPublishRateExceeded​(int msgSize,
                                                   int numMessages)
      • isBrokerPublishRateExceeded

        boolean isBrokerPublishRateExceeded()
      • disableCnxAutoRead

        void disableCnxAutoRead()
      • enableCnxAutoRead

        void enableCnxAutoRead()
      • onPoliciesUpdate

        java.util.concurrent.CompletableFuture<java.lang.Void> onPoliciesUpdate​(org.apache.pulsar.common.policies.data.Policies data)
      • isBacklogQuotaExceeded

        boolean isBacklogQuotaExceeded​(java.lang.String producerName,
                                       org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType)
      • isEncryptionRequired

        boolean isEncryptionRequired()
      • getSchemaValidationEnforced

        boolean getSchemaValidationEnforced()
      • isReplicated

        boolean isReplicated()
      • getBacklogQuota

        org.apache.pulsar.common.policies.data.BacklogQuota getBacklogQuota​(org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType)
      • updateRates

        void updateRates​(NamespaceStats nsStats,
                         org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats currentBundleStats,
                         StatsOutputStream topicStatsStream,
                         ClusterReplicationMetrics clusterReplicationMetrics,
                         java.lang.String namespaceName,
                         boolean hydratePublishers)
      • getSubscription

        Subscription getSubscription​(java.lang.String subscription)
      • getReplicators

        org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap<java.lang.String,​? extends Replicator> getReplicators()
      • getStats

        org.apache.pulsar.common.policies.data.stats.TopicStatsImpl getStats​(boolean getPreciseBacklog,
                                                                             boolean subscriptionBacklogSize)
      • getInternalStats

        java.util.concurrent.CompletableFuture<org.apache.pulsar.common.policies.data.PersistentTopicInternalStats> getInternalStats​(boolean includeLedgerMetadata)
      • getLastPosition

        org.apache.bookkeeper.mledger.Position getLastPosition()
      • getLastMessageId

        java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.MessageId> getLastMessageId()
      • hasSchema

        java.util.concurrent.CompletableFuture<java.lang.Boolean> hasSchema()
        Whether a topic has had a schema defined for it.
      • addSchema

        java.util.concurrent.CompletableFuture<org.apache.pulsar.common.protocol.schema.SchemaVersion> addSchema​(org.apache.pulsar.common.protocol.schema.SchemaData schema)
        Add a schema to the topic. This will fail if the new schema is incompatible with the current schema.
      • deleteSchema

        java.util.concurrent.CompletableFuture<org.apache.pulsar.common.protocol.schema.SchemaVersion> deleteSchema()
        Delete the schema if this topic has a schema defined for it.
      • checkSchemaCompatibleForConsumer

        java.util.concurrent.CompletableFuture<java.lang.Void> checkSchemaCompatibleForConsumer​(org.apache.pulsar.common.protocol.schema.SchemaData schema)
        Check if schema is compatible with current topic schema.
      • addSchemaIfIdleOrCheckCompatible

        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. Otherwise, check that the passed schema is compatible with what the topic already has.
      • deleteForcefully

        java.util.concurrent.CompletableFuture<java.lang.Void> deleteForcefully()
      • getDispatchRateLimiter

        default java.util.Optional<DispatchRateLimiter> getDispatchRateLimiter()
      • isSystemTopic

        default boolean isSystemTopic()
      • isPersistent

        boolean isPersistent()
      • publishTxnMessage

        void publishTxnMessage​(org.apache.pulsar.client.api.transaction.TxnID txnID,
                               io.netty.buffer.ByteBuf headersAndPayload,
                               Topic.PublishContext publishContext)
        Publish Transaction message to this Topic's TransactionBuffer.
        Parameters:
        txnID - Transaction Id
        headersAndPayload - Message data
        publishContext - Publish context
      • endTxn

        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.
        Parameters:
        txnID - Transaction id
        txnAction - Transaction action.
        lowWaterMark - low water mark of this tc
        Returns:
      • truncate

        java.util.concurrent.CompletableFuture<java.lang.Void> truncate()
        Truncate a topic. The truncate operation will move all cursors to the end of the topic and delete all inactive ledgers.
        Returns:
      • getBrokerService

        BrokerService getBrokerService()
        Get BrokerService.
        Returns: