elsa v0.3.0 Elsa.Producer.Manager

Defines functions for starting persistent kafka producer processes that can be managed by a consuming application supervisor.

Link to this section Summary

Functions

Start a named process for handling subsequent produce_sync requests to write messages to a topic. Producer processes are bound to a specific topic. The producer process requires and is managed by a client process, so the client pid is returned to allow for adding the client (and thus the producer) to an application's supervision tree. If the name option is not supplied to the producer's config, the default client name is used.

Stops the named producer process and cleans up entries from the supervisor's child process table in ets.

Link to this section Functions

Link to this function

start_producer(endpoints, topic, config \\ [])
start_producer(keyword(), String.t(), keyword()) ::
  {:ok, pid()} | {:error, term()}

Start a named process for handling subsequent produce_sync requests to write messages to a topic. Producer processes are bound to a specific topic. The producer process requires and is managed by a client process, so the client pid is returned to allow for adding the client (and thus the producer) to an application's supervision tree. If the name option is not supplied to the producer's config, the default client name is used.

Link to this function

stop_producer(client \\ Elsa.default_client(), topic)
stop_producer(atom(), String.t()) :: :ok | no_return()

Stops the named producer process and cleans up entries from the supervisor's child process table in ets.