Class RoundRobinPartitionMessageRouterImpl

  • All Implemented Interfaces:
    java.io.Serializable, org.apache.pulsar.client.api.MessageRouter

    public class RoundRobinPartitionMessageRouterImpl
    extends MessageRouterBase
    The routing strategy here:
    • If a key is present, choose a partition based on a hash of the key.
    • If no key is present, choose a partition in a "round-robin" fashion. Batching-Awareness is built-in to improve batching locality.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      RoundRobinPartitionMessageRouterImpl​(org.apache.pulsar.client.api.HashingScheme hashingScheme, int startPtnIdx, boolean isBatchingEnabled, long partitionSwitchMs)  
      RoundRobinPartitionMessageRouterImpl​(org.apache.pulsar.client.api.HashingScheme hashingScheme, int startPtnIdx, boolean isBatchingEnabled, long partitionSwitchMs, java.time.Clock clock)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int choosePartition​(org.apache.pulsar.client.api.Message<?> msg, org.apache.pulsar.client.api.TopicMetadata topicMetadata)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.pulsar.client.api.MessageRouter

        choosePartition
    • Constructor Detail

      • RoundRobinPartitionMessageRouterImpl

        public RoundRobinPartitionMessageRouterImpl​(org.apache.pulsar.client.api.HashingScheme hashingScheme,
                                                    int startPtnIdx,
                                                    boolean isBatchingEnabled,
                                                    long partitionSwitchMs)
      • RoundRobinPartitionMessageRouterImpl

        public RoundRobinPartitionMessageRouterImpl​(org.apache.pulsar.client.api.HashingScheme hashingScheme,
                                                    int startPtnIdx,
                                                    boolean isBatchingEnabled,
                                                    long partitionSwitchMs,
                                                    java.time.Clock clock)
    • Method Detail

      • choosePartition

        public int choosePartition​(org.apache.pulsar.client.api.Message<?> msg,
                                   org.apache.pulsar.client.api.TopicMetadata topicMetadata)