misha_cafex v0.0.6 Cafex.Producer

Kafka producer

Summary

Types

Options used by the start_link/2 functions

Functions

Produce message to kafka server in the asynchronous way

Produce message to kafka server in the synchronous way

Types

option ::
  {:client_id, Cafex.client_id} |
  {:brokers, [Cafex.broker]} |
  {:acks, -1..32767} |
  {:batch_num, pos_integer} |
  {:linger_ms, non_neg_integer}
options :: [option]

Options used by the start_link/2 functions

Functions

async_produce(pid, value, opts \\ [])

Specs

async_produce(pid :: pid, value :: binary, opts :: [Keyword.t]) :: :ok

Produce message to kafka server in the asynchronous way.

Options

See produce/3

produce(pid, value, opts \\ [])

Specs

produce(pid :: pid, value :: binary, opts :: [Keyword.t]) ::
  :ok |
  {:error, term}

Produce message to kafka server in the synchronous way.

Options

  • :key The key is an optional message key that was used for partition assignment. The key can be nil.
  • :partition The partition that data is being published to.
  • :metadata The metadata is used for partition in case of you wan’t to use key to do that.
start_link(topic_name, opts)

Specs

start_link(topic_name :: String.t, opts :: options) :: GenServer.on_start
stop(pid)

Specs

stop(pid :: pid) :: :ok