Package org.apache.pulsar.client.api
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 java.lang.Object
KeyShared policy for KeyShared subscription.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KeySharedPolicy.KeySharedPolicyAutoSplit
Auto split hash range key shared policy.static class
KeySharedPolicy.KeySharedPolicySticky
Sticky attach topic with fixed hash range.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
allowOutOfOrderDelivery
static int
DEFAULT_HASH_RANGE_SIZE
protected KeySharedMode
keySharedMode
-
Constructor Summary
Constructors Constructor Description KeySharedPolicy()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static KeySharedPolicy.KeySharedPolicyAutoSplit
autoSplitHashRange()
int
getHashRangeTotal()
KeySharedMode
getKeySharedMode()
boolean
isAllowOutOfOrderDelivery()
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.static KeySharedPolicy.KeySharedPolicySticky
stickyHashRange()
abstract void
validate()
-
-
-
Field Detail
-
keySharedMode
protected KeySharedMode keySharedMode
-
allowOutOfOrderDelivery
protected boolean allowOutOfOrderDelivery
-
DEFAULT_HASH_RANGE_SIZE
public static final int DEFAULT_HASH_RANGE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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()
-
-