View Source RabbitMQStream.SuperConsumer (rabbitmq_stream v0.4.0)
Declares a SuperConsumer module, that subscribes to all the partitions of a SuperStream, and ensures there is only one active consumer per Partition.
Usage
defmodule MyApp.MySuperConsumer do
use RabbitMQStream.SuperConsumer,
initial_offset: :next,
super_stream: "my_super_stream",
partitions: 3
@impl true
def handle_message(_message) do
# ...
:ok
end
end
It accepts the same options as a Consumer, plus the following:
:super_stream
- the name of the super stream:partitions
- the number of partitions
All the consumers use the same provided connection, and are supervised by a DynamicSupervisor.
Summary
Types
@type super_consumer_option() :: {:super_stream, String.t()} | {:partitions, non_neg_integer()} | RabbitMQStream.Consumer.option()
@type t() :: %RabbitMQStream.SuperConsumer{ connection: GenServer.server(), consumer_module: module(), consumer_opts: [RabbitMQStream.Consumer.option()] | nil, dynamic_supervisor: module(), partitions: non_neg_integer(), registry: module(), super_stream: String.t() }