Class KeySharedPolicy

java.lang.Object
org.apache.pulsar.client.api.KeySharedPolicy
Direct Known Subclasses:
KeySharedPolicy.KeySharedPolicyAutoSplit, KeySharedPolicy.KeySharedPolicySticky

@Public @Stable public abstract class KeySharedPolicy extends Object
KeyShared policy for KeyShared subscription.
  • Field Details

    • keySharedMode

      protected KeySharedMode keySharedMode
    • allowOutOfOrderDelivery

      protected boolean allowOutOfOrderDelivery
    • DEFAULT_HASH_RANGE_SIZE

      public static final int DEFAULT_HASH_RANGE_SIZE
      See Also:
  • Constructor Details

    • KeySharedPolicy

      public KeySharedPolicy()
  • Method Details

    • autoSplitHashRange

      public static KeySharedPolicy.KeySharedPolicyAutoSplit autoSplitHashRange()
    • stickyHashRange

      public static KeySharedPolicy.KeySharedPolicySticky stickyHashRange()
    • validate

      public abstract void validate()
    • setAllowOutOfOrderDelivery

      public KeySharedPolicy setAllowOutOfOrderDelivery(boolean allowOutOfOrderDelivery)
      If enabled, it will relax the ordering requirement, allowing the broker to send out-of-order messages in case of failures. This will make it faster for new consumers to join without being stalled by an existing slow consumer.

      In this case, a single consumer will still receive all the keys, but they may be coming in different orders.

      Parameters:
      allowOutOfOrderDelivery - whether to allow for out of order delivery
      Returns:
      KeySharedPolicy instance
    • isAllowOutOfOrderDelivery

      public boolean isAllowOutOfOrderDelivery()
    • getKeySharedMode

      public KeySharedMode getKeySharedMode()
    • getHashRangeTotal

      public int getHashRangeTotal()