Class NonPersistentSubscription

java.lang.Object
org.apache.pulsar.broker.service.AbstractSubscription
org.apache.pulsar.broker.service.nonpersistent.NonPersistentSubscription
All Implemented Interfaces:
MessageExpirer, Subscription

public class NonPersistentSubscription extends AbstractSubscription
  • Constructor Details

  • Method Details

    • interceptor

      public BrokerInterceptor interceptor()
    • getName

      public String getName()
    • getTopic

      public Topic getTopic()
    • isReplicated

      public boolean isReplicated()
    • addConsumer

      public CompletableFuture<Void> addConsumer(Consumer consumer)
    • removeConsumer

      public void removeConsumer(Consumer consumer, boolean isResetCursor) throws BrokerServiceException
      Throws:
      BrokerServiceException
    • consumerFlow

      public void consumerFlow(Consumer consumer, int additionalNumberOfMessages)
    • acknowledgeMessage

      public void acknowledgeMessage(List<Position> position, org.apache.pulsar.common.api.proto.CommandAck.AckType ackType, Map<String,Long> properties)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTopicName

      public String getTopicName()
    • getType

      public org.apache.pulsar.common.api.proto.CommandSubscribe.SubType getType()
    • getTypeString

      public String getTypeString()
    • clearBacklog

      public CompletableFuture<Void> clearBacklog()
    • skipMessages

      public CompletableFuture<Void> skipMessages(int numMessagesToSkip)
    • resetCursor

      public CompletableFuture<Void> resetCursor(long timestamp)
    • peekNthMessage

      public CompletableFuture<Entry> peekNthMessage(int messagePosition)
    • getNumberOfEntriesInBacklog

      public long getNumberOfEntriesInBacklog(boolean getPreciseBacklog)
    • getDispatcher

      public NonPersistentDispatcher getDispatcher()
    • isSubscriptionMigrated

      public boolean isSubscriptionMigrated()
    • disconnect

      public CompletableFuture<Void> disconnect(Optional<BrokerLookupData> assignedBrokerLookupData)
      Disconnect all consumers from this subscription.
      Returns:
      CompletableFuture indicating the completion of the operation.
    • close

      public CompletableFuture<Void> close(boolean disconnectConsumers, Optional<BrokerLookupData> assignedBrokerLookupData)
      Fence this subscription and optionally disconnect all consumers.
      Returns:
      CompletableFuture indicating the completion of the operation.
    • delete

      public CompletableFuture<Void> delete()
      Delete the subscription by closing and deleting its managed cursor if no consumers are connected to it. Handle unsubscribe call from admin layer.
      Returns:
      CompletableFuture indicating the completion of delete operation
    • deleteForcefully

      public CompletableFuture<Void> deleteForcefully()
      Forcefully close all consumers and deletes the subscription.
      Returns:
    • doUnsubscribe

      public CompletableFuture<Void> doUnsubscribe(Consumer consumer)
      Handle unsubscribe command from the client API Check with the dispatcher is this consumer can proceed with unsubscribe.
      Parameters:
      consumer - consumer object that is initiating the unsubscribe operation
      Returns:
      CompletableFuture indicating the completion of ubsubscribe operation
    • doUnsubscribe

      public CompletableFuture<Void> doUnsubscribe(Consumer consumer, boolean force)
      Handle unsubscribe command from the client API Check with the dispatcher is this consumer can proceed with unsubscribe.
      Parameters:
      consumer - consumer object that is initiating the unsubscribe operation
      force - unsubscribe forcefully by disconnecting consumers and closing subscription
      Returns:
      CompletableFuture indicating the completion of ubsubscribe operation
    • getConsumers

      public List<Consumer> getConsumers()
    • expireMessages

      public boolean expireMessages(int messageTTLInSeconds)
    • expireMessages

      public boolean expireMessages(Position position)
    • getStats

      public org.apache.pulsar.common.policies.data.stats.NonPersistentSubscriptionStatsImpl getStats(GetStatsOptions getStatsOptions)
    • redeliverUnacknowledgedMessages

      public void redeliverUnacknowledgedMessages(Consumer consumer, long consumerEpoch)
    • redeliverUnacknowledgedMessages

      public void redeliverUnacknowledgedMessages(Consumer consumer, List<Position> positions)
    • addUnAckedMessages

      public void addUnAckedMessages(int unAckMessages)
    • getExpiredMessageRate

      public double getExpiredMessageRate()
    • markTopicWithBatchMessagePublished

      public void markTopicWithBatchMessagePublished()
    • resetCursor

      public CompletableFuture<Void> resetCursor(Position position)
    • endTxn

      public CompletableFuture<Void> endTxn(long txnidMostBits, long txnidLeastBits, int txnAction, long lowWaterMark)
    • analyzeBacklog

      public CompletableFuture<AnalyzeBacklogResult> analyzeBacklog(Optional<Position> position)
    • getSubscriptionProperties

      public Map<String,String> getSubscriptionProperties()
    • updateSubscriptionProperties

      public CompletableFuture<Void> updateSubscriptionProperties(Map<String,String> subscriptionProperties)