Interface Topic

All Known Implementing Classes:
AbstractTopic, NonPersistentTopic, PersistentTopic, SystemTopic

public interface Topic
  • Method Details

    • initialize

      CompletableFuture<Void> initialize()
    • publishMessage

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

      CompletableFuture<Optional<Long>> addProducer(Producer producer, CompletableFuture<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

      CompletableFuture<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, TimeUnit unit)
      record add-latency.
    • increasePublishLimitedTimes

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

      @Deprecated CompletableFuture<Consumer> 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 startMessageRollbackDurationSec, boolean replicateSubscriptionState, org.apache.pulsar.common.api.proto.KeySharedMeta keySharedMeta)
      Deprecated.
    • subscribe

      Subscribe a topic.
      Parameters:
      option -
      Returns:
    • createSubscription

      CompletableFuture<Subscription> createSubscription(String subscriptionName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, boolean replicateSubscriptionState, Map<String,String> properties)
    • unsubscribe

      CompletableFuture<Void> unsubscribe(String subName)
    • getSubscriptions

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

    • getProducers

      Map<String,Producer> getProducers()
    • getName

      String getName()
    • checkReplication

      CompletableFuture<Void> checkReplication()
    • close

      CompletableFuture<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.
    • checkCursorsToCacheEntries

      void checkCursorsToCacheEntries()
    • 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

      CompletableFuture<Void> onPoliciesUpdate(org.apache.pulsar.common.policies.data.Policies data)
    • checkBacklogQuotaExceeded

      CompletableFuture<Void> checkBacklogQuotaExceeded(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, String namespaceName, boolean hydratePublishers)
    • getSubscription

      Subscription getSubscription(String subscription)
    • getReplicators

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

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

      CompletableFuture<? extends org.apache.pulsar.common.policies.data.stats.TopicStatsImpl> asyncGetStats(boolean getPreciseBacklog, boolean subscriptionBacklogSize, boolean getEarliestTimeInBacklog)
    • getInternalStats

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

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

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

      Whether a topic has had a schema defined for it.
    • addSchema

      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

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

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

      CompletableFuture<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

      CompletableFuture<Void> deleteForcefully()
    • getDispatchRateLimiter

      default Optional<DispatchRateLimiter> getDispatchRateLimiter()
    • getSubscribeRateLimiter

      default Optional<SubscribeRateLimiter> getSubscribeRateLimiter()
    • getBrokerDispatchRateLimiter

      default Optional<DispatchRateLimiter> getBrokerDispatchRateLimiter()
    • 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

      CompletableFuture<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

      CompletableFuture<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:
    • getHierarchyTopicPolicies

      org.apache.pulsar.common.policies.data.HierarchyTopicPolicies getHierarchyTopicPolicies()
      Get HierarchyTopicPolicies.
      Returns: