View Source ExRocketmq.Producer.MqSelector behaviour (lib_oss v0.1.0)
Provides a behaviour for selecting MessageQueues in the ExRocketmq Producer.
MQ selectors implementing this behaviour are responsible for selecting the appropriate MessageQueue when sending messages to RocketMQ. This allows plugging in different selection strategies like random, round-robin, etc.
To use a custom MQ selector, implement the new/1
, start/1
, stop/1
and
select/3
callbacks and pass the module as the :mq_selector
option to the
ExRocketmq.Producer
constructor.
Summary
Types
@type t() :: struct()
Callbacks
@callback new(ExRocketmq.Typespecs.opts()) :: t()
@callback select(t(), ExRocketmq.Models.Message.t(), [ExRocketmq.Models.MessageQueue.t()]) :: ExRocketmq.Models.MessageQueue.t()
@callback stop(t()) :: :ok
Functions
@spec select(t(), ExRocketmq.Models.Message.t(), [ExRocketmq.Models.MessageQueue.t()]) :: ExRocketmq.Models.MessageQueue.t()
@spec stop(t()) :: :ok