off_broadway_kafka v0.3.1 OffBroadway.Kafka.Producer

Implements the logic to handle incoming messages through the broadway pipeline. Sends messages to the handle_info/2 and handle_demand/2 functions based on requests and tracks acknowledgements in state.

Link to this section Summary

Functions

Handle message events based on demand. Updates the demand based on the existing demand in state and sends the requested number of message events.

Handle assignments revoked by kafka broker. Should wait until acknowledgers and reported as empty and clean out any events in queue

Convenience function for sending messages to be produced via the handle_info/2 function.

Names the producer process and initializes state for the producer GenServer.

Starts an OffBroadway.Kafka producer process linked to the current process.

Handles termination of the Elsa consumer group supervisor process if one exists.

Link to this section Functions

Link to this function

assignments_revoked(pid)
assignments_revoked(pid()) :: :ok

Link to this function

handle_demand(demand, state)
handle_demand(non_neg_integer(), map()) :: :ok

Handle message events based on demand. Updates the demand based on the existing demand in state and sends the requested number of message events.

Link to this function

handle_info(arg, state)
handle_info({:process_messages, [term()]}, map()) :: :ok
handle_info({:assignments_revoked, pid()}, map()) ::
  {:noreply, list(), map()}

Handle assignments revoked by kafka broker. Should wait until acknowledgers and reported as empty and clean out any events in queue

Link to this function

handle_messages(pid, messages)
handle_messages(pid(), term()) :: :ok

Convenience function for sending messages to be produced via the handle_info/2 function.

Names the producer process and initializes state for the producer GenServer.

  • if args contain a value for :brokers or :endpoints, creates a handler config and passes it to the Elsa library to start a consumer group supervisor and store the returned pid in the Broadway Producer state for reference.
Link to this function

start_link(opts)

Starts an OffBroadway.Kafka producer process linked to the current process.

Link to this function

terminate(reason, arg2)
terminate(term(), map()) :: :ok

Handles termination of the Elsa consumer group supervisor process if one exists.