Class NonPersistentTopic

    • Constructor Detail

      • NonPersistentTopic

        public NonPersistentTopic​(java.lang.String topic,
                                  BrokerService brokerService)
    • Method Detail

      • initialize

        public java.util.concurrent.CompletableFuture<java.lang.Void> initialize()
        Specified by:
        initialize in interface Topic
      • incrementTopicEpoch

        protected java.util.concurrent.CompletableFuture<java.lang.Long> incrementTopicEpoch​(java.util.Optional<java.lang.Long> currentEpoch)
        Specified by:
        incrementTopicEpoch in class AbstractTopic
      • setTopicEpoch

        protected java.util.concurrent.CompletableFuture<java.lang.Long> setTopicEpoch​(long newEpoch)
        Specified by:
        setTopicEpoch in class AbstractTopic
      • checkIfTransactionBufferRecoverCompletely

        public java.util.concurrent.CompletableFuture<java.lang.Void> checkIfTransactionBufferRecoverCompletely​(boolean isTxnEnabled)
        Description copied from interface: Topic
        Wait TransactionBuffer Recovers completely. Take snapshot after TB Recovers completely.
        Specified by:
        checkIfTransactionBufferRecoverCompletely in interface Topic
        Returns:
        a future which has completely if isTxn = false. Or a future return by takeSnapshot.
      • subscribe

        public java.util.concurrent.CompletableFuture<Consumer> subscribe​(SubscriptionOption option)
        Description copied from interface: Topic
        Subscribe a topic.
        Specified by:
        subscribe in interface Topic
        Returns:
      • 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 resetStartMessageBackInSec,
                                                                          boolean replicateSubscriptionState,
                                                                          org.apache.pulsar.common.api.proto.KeySharedMeta keySharedMeta)
        Specified by:
        subscribe in interface Topic
      • createSubscription

        public java.util.concurrent.CompletableFuture<Subscription> createSubscription​(java.lang.String subscriptionName,
                                                                                       org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition,
                                                                                       boolean replicateSubscriptionState,
                                                                                       java.util.Map<java.lang.String,​java.lang.String> properties)
        Specified by:
        createSubscription in interface Topic
      • delete

        public java.util.concurrent.CompletableFuture<java.lang.Void> delete()
        Specified by:
        delete in interface Topic
      • deleteForcefully

        public java.util.concurrent.CompletableFuture<java.lang.Void> deleteForcefully()
        Forcefully close all producers/consumers/replicators and deletes the topic.
        Specified by:
        deleteForcefully in interface Topic
        Returns:
      • close

        public java.util.concurrent.CompletableFuture<java.lang.Void> close​(boolean closeWithoutWaitingClientDisconnect)
        Close this topic - close all producers and subscriptions associated with this topic.
        Specified by:
        close in interface Topic
        Parameters:
        closeWithoutWaitingClientDisconnect - don't wait for client disconnect and forcefully close managed-ledger
        Returns:
        Completable future indicating completion of close operation
      • stopReplProducers

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

        public java.util.concurrent.CompletableFuture<java.lang.Void> checkReplication()
        Specified by:
        checkReplication in interface Topic
      • addReplicationCluster

        protected java.util.concurrent.CompletableFuture<java.lang.Void> addReplicationCluster​(java.lang.String remoteCluster,
                                                                                               NonPersistentTopic nonPersistentTopic,
                                                                                               java.lang.String localCluster)
      • getPersistentReplicator

        public Replicator getPersistentReplicator​(java.lang.String remoteCluster)
      • getStats

        public org.apache.pulsar.common.policies.data.stats.NonPersistentTopicStatsImpl getStats​(boolean getPreciseBacklog,
                                                                                                 boolean subscriptionBacklogSize,
                                                                                                 boolean getEarliestTimeInBacklog)
        Specified by:
        getStats in interface Topic
      • asyncGetStats

        public java.util.concurrent.CompletableFuture<org.apache.pulsar.common.policies.data.stats.NonPersistentTopicStatsImpl> asyncGetStats​(boolean getPreciseBacklog,
                                                                                                                                              boolean subscriptionBacklogSize,
                                                                                                                                              boolean getEarliestTimeInBacklog)
        Specified by:
        asyncGetStats in interface Topic
      • getInternalStats

        public java.util.concurrent.CompletableFuture<org.apache.pulsar.common.policies.data.PersistentTopicInternalStats> getInternalStats​(boolean includeLedgerMetadata)
        Specified by:
        getInternalStats in interface Topic
      • isActive

        public boolean isActive()
      • checkGC

        public void checkGC()
        Specified by:
        checkGC in interface Topic
      • checkBackloggedCursors

        public void checkBackloggedCursors()
        Description copied from interface: Topic
        Activate cursors those caught up backlog-threshold entries and deactivate slow cursors which are creating backlog.
        Specified by:
        checkBackloggedCursors in interface Topic
      • onPoliciesUpdate

        public java.util.concurrent.CompletableFuture<java.lang.Void> onPoliciesUpdate​(org.apache.pulsar.common.policies.data.Policies data)
        Specified by:
        onPoliciesUpdate in interface Topic
      • onUpdate

        public void onUpdate​(org.apache.pulsar.common.policies.data.TopicPolicies data)
        Specified by:
        onUpdate in interface TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies>
      • getBacklogQuota

        public org.apache.pulsar.common.policies.data.BacklogQuota getBacklogQuota​(org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType)
        Specified by:
        getBacklogQuota in interface Topic
        Returns:
        Backlog quota for topic
      • checkBacklogQuotaExceeded

        public java.util.concurrent.CompletableFuture<java.lang.Void> checkBacklogQuotaExceeded​(java.lang.String producerName,
                                                                                                org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType)
        Specified by:
        checkBacklogQuotaExceeded in interface Topic
        Returns:
        quota exceeded status for blocking producer creation
      • isReplicated

        public boolean isReplicated()
        Specified by:
        isReplicated in interface Topic
      • unsubscribe

        public java.util.concurrent.CompletableFuture<java.lang.Void> unsubscribe​(java.lang.String subscriptionName)
        Specified by:
        unsubscribe in interface Topic
      • getLastPosition

        public org.apache.bookkeeper.mledger.Position getLastPosition()
        Specified by:
        getLastPosition in interface Topic
      • getLastMessageId

        public java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.MessageId> getLastMessageId()
        Specified by:
        getLastMessageId in interface Topic
      • addSchemaIfIdleOrCheckCompatible

        public java.util.concurrent.CompletableFuture<java.lang.Void> addSchemaIfIdleOrCheckCompatible​(org.apache.pulsar.common.protocol.schema.SchemaData schema)
        Description copied from interface: Topic
        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.
        Specified by:
        addSchemaIfIdleOrCheckCompatible in interface Topic
      • publishTxnMessage

        public void publishTxnMessage​(org.apache.pulsar.client.api.transaction.TxnID txnID,
                                      io.netty.buffer.ByteBuf headersAndPayload,
                                      Topic.PublishContext publishContext)
        Description copied from interface: Topic
        Publish Transaction message to this Topic's TransactionBuffer.
        Specified by:
        publishTxnMessage in interface Topic
        Parameters:
        txnID - Transaction Id
        headersAndPayload - Message data
        publishContext - 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: Topic
        End the transaction in this topic.
        Specified by:
        endTxn in interface Topic
        Parameters:
        txnID - Transaction id
        txnAction - Transaction action.
        lowWaterMark - low water mark of this tc
        Returns:
      • truncate

        public java.util.concurrent.CompletableFuture<java.lang.Void> truncate()
        Description copied from interface: Topic
        Truncate a topic. The truncate operation will move all cursors to the end of the topic and delete all inactive ledgers.
        Specified by:
        truncate in interface Topic
        Returns:
      • isPersistent

        public boolean isPersistent()
        Specified by:
        isPersistent in interface Topic