View Source ExRocketmq.Consumer.BalanceStrategy behaviour (lib_oss v0.1.0)

The balance strategy behaviour of consumer

Summary

Functions

Implementing a strategy to allocate an appropriate message queue for the current client

Types

Callbacks

Link to this callback

allocate(m, client_id, mq_all, cid_all)

View Source
@callback allocate(
  m :: t(),
  client_id :: String.t(),
  mq_all :: [ExRocketmq.Models.MessageQueue.t()],
  cid_all :: [String.t()]
) :: {:ok, [ExRocketmq.Models.MessageQueue.t()]}

Functions

Link to this function

allocate(m, client_id, mq_all, cid_all)

View Source
@spec allocate(
  m :: t(),
  client_id :: String.t(),
  mq_all :: [ExRocketmq.Models.MessageQueue.t()],
  cid_all :: [String.t()]
) :: {:ok, [ExRocketmq.Models.MessageQueue.t()]}

Implementing a strategy to allocate an appropriate message queue for the current client

Examples

iex> ExRocketmq.Consumer.BalanceStrategy.allocate(
       ExRocketmq.Consumer.BalanceStrategy.Average.new(),
       "c1",
       [mq1, mq2, mq3],
       [c1, c2, c3]
     )
{:ok, [mq1]}