Package org.apache.pulsar.broker.service
Interface StickyKeyConsumerSelector
- All Known Implementing Classes:
ConsistentHashingStickyKeyConsumerSelector,HashRangeAutoSplitStickyKeyConsumerSelector,HashRangeExclusiveStickyKeyConsumerSelector
public interface StickyKeyConsumerSelector
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConsumer(Consumer consumer) Add a new consumer.Get key hash ranges handled by each consumer.static intmakeStickyKeyHash(byte[] stickyKey) voidremoveConsumer(Consumer consumer) Remove the consumer.default Consumerselect(byte[] stickyKey) Select a consumer by sticky key.select(int hash) Select a consumer by hash.
-
Field Details
-
DEFAULT_RANGE_SIZE
static final int DEFAULT_RANGE_SIZE- See Also:
-
-
Method Details
-
addConsumer
Add a new consumer.- Parameters:
consumer- new consumer- Throws:
BrokerServiceException.ConsumerAssignException
-
removeConsumer
Remove the consumer.- Parameters:
consumer- consumer to be removed
-
select
Select a consumer by sticky key.- Parameters:
stickyKey- sticky key- Returns:
- consumer
-
makeStickyKeyHash
static int makeStickyKeyHash(byte[] stickyKey) -
select
Select a consumer by hash.- Parameters:
hash- hash corresponding to sticky key- Returns:
- consumer
-
getConsumerKeyHashRanges
Get key hash ranges handled by each consumer.- Returns:
- A map where key is a consumer name and value is list of hash range it receiving message for.
-