Module brod_producer

Behaviours: gen_server.

Data Types

call_ref()

call_ref() = brod:call_ref()

config()

config() = proplists:proplist()

offset()

offset() = brod:offset()

partition()

partition() = brod:partition()

topic()

topic() = brod:topic()

Function Index

produce/3Produce a message to partition asynchronizely.
produce_cb/4Async produce, evaluate callback if AckCb is a function otherwise send #brod_produce_reply{result = brod_produce_req_acked} message to caller after the produce request has been acked by kafka.
produce_no_ack/3Fire-n-forget, no ack, no back-pressure.
start_link/4Start (link) a partition producer.
stop/1Stop the process.
sync_produce_request/2Block calling process until it receives an acked reply for the CallRef.

Function Details

produce/3

produce(Pid::pid(), Key::brod:key(), Value::brod:value()) -> {ok, call_ref()} | {error, any()}

Produce a message to partition asynchronizely. The call is blocked until the request has been buffered in producer worker The function returns a call reference of type call_ref() to the caller so the caller can used it to expect (match) a #brod_produce_reply{result = brod_produce_req_acked} message after the produce request has been acked by kafka.

produce_cb/4

produce_cb(Pid::pid(), Key::brod:key(), Value::brod:value(), AckCb::undefined | brod:produce_ack_cb()) -> ok | {ok, call_ref()} | {error, any()}

Async produce, evaluate callback if AckCb is a function otherwise send #brod_produce_reply{result = brod_produce_req_acked} message to caller after the produce request has been acked by kafka.

produce_no_ack/3

produce_no_ack(Pid::pid(), Key::brod:key(), Value::brod:value()) -> ok

Fire-n-forget, no ack, no back-pressure.

start_link/4

start_link(ClientPid::pid(), Topic::topic(), Partition::partition(), Config::config()) -> {ok, pid()}

Start (link) a partition producer.

Possible configs:

stop/1

stop(Pid::pid()) -> ok

Stop the process

sync_produce_request/2

sync_produce_request(CallRef::call_ref(), Timeout::timeout()) -> {ok, offset()} | {error, Reason}

Block calling process until it receives an acked reply for the CallRef. The caller pid of this function must be the caller of produce/3 in which the call reference was created.


Generated by EDoc