View Source KafkaEx.GenConsumer.Supervisor (kafka_ex v0.13.0)
A supervisor for managing GenConsumer
processes that are part of a consumer
group.
The supervisor will launch individual GenConsumer
processes for each
partition given by the partitions
argument to start_link/4
. When
terminated, each of the supervisor's child processes will commit its latest
offset before terminating.
This module manages a static list of consumer processes. For dynamically
distributing consumers in a consumer group across a cluster of nodes, see
KafkaEx.ConsumerGroup
.
Link to this section Summary
Functions
Returns true if any child pids are alive
Returns a list of child pids
Returns a specification to start this module under a supervisor.
Starts a GenConsumer.Supervisor
process linked to the current process.
Starts a GenConsumer.Supervisor
process linked to the current process.
Link to this section Functions
@spec active?(Supervisor.supervisor()) :: boolean()
Returns true if any child pids are alive
Returns a list of child pids
Intended to be used for operational and testing purposes
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec start_link(%{ gen_consumer_module: module(), consumer_module: module(), group_name: binary(), assignments: [{topic_name :: binary(), partition_id :: non_neg_integer()}], opts: KafkaEx.GenConsumer.options() }) :: Supervisor.on_start()
Starts a GenConsumer.Supervisor
process linked to the current process.
gen_consumer_module
is a module that implements the GenServer
behaviour
which consumes events from Kafka.
consumer_module
is a module that implements the GenConsumer
behaviour.
group_name
is the name of a consumer group.
assignments
is a list of partitions for the GenConsumer
s to consume.
opts
accepts the same options as KafkaEx.GenConsumer.start_link/5
.
return-values
Return Values
This function has the same return values as Supervisor.start_link/3
.
If the supervisor and its consumers are successfully created, this function
returns {:ok, pid}
, where pid
is the PID of the supervisor.
@spec start_link( {gen_consumer_module :: module(), consumer_module :: module()}, consumer_group_name :: binary(), assigned_partitions :: [ {topic_name :: binary(), partition_id :: non_neg_integer()} ], KafkaEx.GenConsumer.options() ) :: Supervisor.on_start()
Starts a GenConsumer.Supervisor
process linked to the current process.
Refer to start_link/1
for documentation of each parameter.
return-values
Return Values
Same as start_link/1
.