KafkaEx.GenConsumer.Supervisor (kafka_ex v0.12.1) View Source

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.

Link to this section Functions

Specs

active?(Supervisor.supervisor()) :: boolean()

Returns true if any child pids are alive

Link to this function

child_pids(supervisor_pid)

View Source

Specs

child_pids(pid() | atom()) :: [pid()]

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.

Link to this function

start_link(arg, group_name, assignments, opts \\ [])

View Source

Specs

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.

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, and assignments is a list of partitions for the GenConsumers to consume. opts accepts the same options as KafkaEx.GenConsumer.start_link/5.

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.