View Source ExRocketmq.Producer.Selector.Hash (lib_oss v0.1.0)

Implements hash-based MessageQueue selection for the ExRocketmq Producer.

It uses consistent hashing to map messages to queues based on the value of a sharding key property on the message. If no sharding key is present, it falls back to random selection.

The sharding key used is the :sharding_key property defined in the RocketMQ protocol.

To use this hash-based selector, pass the ExRocketmq.Producer.Selector.Hash module as the :selector option when constructing a Producer:

producer = ExRocketmq.Producer.start_link(

selector: ExRocketmq.Producer.Selector.Hash.new([])

)

Summary

Types

@type t() :: %ExRocketmq.Producer.Selector.Hash{}

Functions