View Source ExRocketmq.Consumer.BuffManager (lib_oss v0.1.0)

BuffManager is responsible for managing buffers for RocketMQ consumers.

Usage

To use BuffManager, you need to start it using start_link/1 function and provide a name:

{:ok, pid} = ExRocketmq.Consumer.BuffManager.start_link(name: :buff_manager)

Once started, you can use the get_or_new/3 function to retrieve or create a buffer for a specific topic and queue ID.

Example

{:buff, offset, commit} = ExRocketmq.Consumer.BuffManager.get_or_new(:buff_manager, %MessageQueue{topic: "my_topic", queue_id: 1})

Summary

Types

@type t() :: %ExRocketmq.Consumer.BuffManager{}

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

delete_buff(name, message_queue)

View Source
@spec delete_buff(name :: atom(), ExRocketmq.Models.MessageQueue.t()) :: boolean()
Link to this function

get(name, message_queue)

View Source
@spec get(name :: atom(), ExRocketmq.Models.MessageQueue.t()) ::
  {buff :: atom(), offset :: non_neg_integer(), commit? :: boolean()} | nil
Link to this function

get_or_new(name, message_queue)

View Source
@spec get_or_new(name :: atom(), ExRocketmq.Models.MessageQueue.t()) ::
  {buff :: atom(), offset :: non_neg_integer(), commit? :: boolean()}
@spec start_link([{:name, atom()}]) :: Agent.on_start()
Link to this function

update_offset(name, message_queue, offset)

View Source
@spec update_offset(
  name :: atom(),
  mq :: ExRocketmq.Models.MessageQueue.t(),
  offset :: non_neg_integer()
) :: boolean()