View Source Elsa.Group.Manager.WorkerSupervisor (Elsa.fi v2.5.0)

Provides functions to encapsulate the management of worker processes by the consumer group manager.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Retrieve the generation id, used in tracking assignments of workers to topic/partition, from the worker state map.

Restart the specified worker from the manager state. Retrieve the latest recorded offset and pass it to the new worker to pick up where the previous left off if it has been recorded.

Start the main Supervisor. On init this will start a single DynamicSupervisor as a child.

Construct an argument payload for instantiating a worker process, generate a topic/partition assignment and instantiate the worker process with both under the dynamic supervisor. Record the manager-relevant information and store in the manager state map tracking active worker processes.

Terminate all workers under the supervisor, giving them a chance to exit gracefully.

Link to this section Functions

Link to this macro

brod_received_assignment(args \\ [])

View Source (macro)
Link to this macro

brod_received_assignment(record, args)

View Source (macro)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

get_generation_id(workers, topic, partition)

View Source
@spec get_generation_id(map(), Elsa.topic(), Elsa.partition()) ::
  Elsa.Group.Manager.generation_id()

Retrieve the generation id, used in tracking assignments of workers to topic/partition, from the worker state map.

Link to this function

restart_worker(workers, ref, state)

View Source
@spec restart_worker(map(), reference(), struct()) :: map()

Restart the specified worker from the manager state. Retrieve the latest recorded offset and pass it to the new worker to pick up where the previous left off if it has been recorded.

@spec start_link(keyword()) :: GenServer.on_start()

Start the main Supervisor. On init this will start a single DynamicSupervisor as a child.

Options: :connection - Elsa.connection that will identify this supervisor in the Elsa registry.

Link to this function

start_worker(workers, generation_id, assignment, state)

View Source
@spec start_worker(map(), integer(), tuple(), struct()) :: map()

Construct an argument payload for instantiating a worker process, generate a topic/partition assignment and instantiate the worker process with both under the dynamic supervisor. Record the manager-relevant information and store in the manager state map tracking active worker processes.

Link to this function

stop_all_workers(connection, workers, options \\ [])

View Source
@spec stop_all_workers(Elsa.connection(), map(), list()) :: map()

Terminate all workers under the supervisor, giving them a chance to exit gracefully.

Options: :restart_supervisor - if true, this function will restart the dynamic supervisor after killing it off.

Default true.