Current section
Files
Jump to
Current section
Files
src/franz@producers.erl
-module(franz@producers).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([produce_sync_offset/5, produce_sync/5, produce/5, produce_cb/6]).
-export_type([producer_partition/0, partitioner/0, value/0]).
-type producer_partition() :: {partition, integer()} |
{partitioner, partitioner()}.
-type partitioner() :: {partition_fun,
fun((binary(), integer(), bitstring(), bitstring()) -> {ok, integer()} |
{error, nil})} |
random |
hash.
-type value() :: {value, bitstring(), list({binary(), binary()})} |
{value_with_timestamp, bitstring(), integer(), list({binary(), binary()})}.
-file("src/franz/producers.gleam", 24).
-spec produce_sync_offset(
franz:franz_client(),
binary(),
producer_partition(),
bitstring(),
value()
) -> {ok, integer()} | {error, franz:franz_error()}.
produce_sync_offset(Client, Topic, Partition, Key, Value) ->
franz_ffi:produce_sync_offset(Client, Topic, Partition, Key, Value).
-file("src/franz/producers.gleam", 33).
-spec produce_sync(
franz:franz_client(),
binary(),
producer_partition(),
bitstring(),
value()
) -> {ok, nil} | {error, franz:franz_error()}.
produce_sync(Client, Topic, Partition, Key, Value) ->
franz_ffi:produce_sync(Client, Topic, Partition, Key, Value).
-file("src/franz/producers.gleam", 42).
-spec produce(
franz:franz_client(),
binary(),
producer_partition(),
bitstring(),
value()
) -> {ok, nil} | {error, franz:franz_error()}.
produce(Client, Topic, Partition, Key, Value) ->
franz_ffi:produce(Client, Topic, Partition, Key, Value).
-file("src/franz/producers.gleam", 51).
-spec produce_cb(
franz:franz_client(),
binary(),
producer_partition(),
bitstring(),
value(),
fun((integer(), integer()) -> any())
) -> {ok, integer()} | {error, franz:franz_error()}.
produce_cb(Client, Topic, Partition, Key, Value, Callback) ->
franz_ffi:produce_cb(Client, Topic, Partition, Key, Value, Callback).