Class AbstractSubscription

java.lang.Object
org.apache.pulsar.broker.service.AbstractSubscription
All Implemented Interfaces:
MessageExpirer, Subscription
Direct Known Subclasses:
NonPersistentSubscription, PersistentSubscription

public abstract class AbstractSubscription extends Object implements Subscription
  • Field Details

    • bytesOutFromRemovedConsumers

      protected final LongAdder bytesOutFromRemovedConsumers
    • msgOutFromRemovedConsumer

      protected final LongAdder msgOutFromRemovedConsumer
  • Constructor Details

    • AbstractSubscription

      public AbstractSubscription()
  • Method Details

    • getMsgOutCounter

      public long getMsgOutCounter()
    • getBytesOutCounter

      public long getBytesOutCounter()
    • checkForConsumerCompatibilityErrorWithDispatcher

      protected Optional<CompletableFuture<Void>> checkForConsumerCompatibilityErrorWithDispatcher(Dispatcher dispatcher, Consumer consumer)
      Checks if the given consumer is compatible with the given dispatcher. They are incompatible if
      • the subscription type of the consumer differs from the subscription type of the dispatcher or
      • if both the consumer and dispatcher are of CommandSubscribe.SubType.Key_Shared type but their policies differ (KeySharedMode.AUTO_SPLIT/ KeySharedMode.STICKY or allowOutOfOrderDelivery true/false).
      Parameters:
      dispatcher - The dispatcher of the subscription
      consumer - New consumer to be added to the subscription
      Returns:
      Optional containing failed future with BrokerServiceException.SubscriptionBusyException if consumer and dispatcher are incompatible or empty optional otherwise.