Package org.apache.pulsar.broker.service
Interface StickyKeyConsumerSelector
-
- All Known Implementing Classes:
ConsistentHashingStickyKeyConsumerSelector,HashRangeAutoSplitStickyKeyConsumerSelector,HashRangeExclusiveStickyKeyConsumerSelector
public interface StickyKeyConsumerSelector
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_RANGE_SIZE
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddConsumer(Consumer consumer)Add a new consumer.java.util.Map<Consumer,java.util.List<org.apache.pulsar.client.api.Range>>getConsumerKeyHashRanges()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.Consumerselect(int hash)Select a consumer by hash.
-
-
-
Field Detail
-
DEFAULT_RANGE_SIZE
static final int DEFAULT_RANGE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
addConsumer
void addConsumer(Consumer consumer) throws BrokerServiceException.ConsumerAssignException
Add a new consumer.- Parameters:
consumer- new consumer- Throws:
BrokerServiceException.ConsumerAssignException
-
removeConsumer
void removeConsumer(Consumer consumer)
Remove the consumer.- Parameters:
consumer- consumer to be removed
-
select
default Consumer select(byte[] stickyKey)
Select a consumer by sticky key.- Parameters:
stickyKey- sticky key- Returns:
- consumer
-
makeStickyKeyHash
static int makeStickyKeyHash(byte[] stickyKey)
-
select
Consumer select(int hash)
Select a consumer by hash.- Parameters:
hash- hash corresponding to sticky key- Returns:
- consumer
-
getConsumerKeyHashRanges
java.util.Map<Consumer,java.util.List<org.apache.pulsar.client.api.Range>> 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.
-
-