Module brod_topic_subscriber

A topic subscriber is a gen_server which subscribes to all or a given set of partition consumers (pollers) of a given topic and calls the user-defined callback functions for message processing.

Behaviours: gen_server.

This module defines the brod_topic_subscriber behaviour.
Required callback functions: init/2, handle_message/3.

Description

A topic subscriber is a gen_server which subscribes to all or a given set of partition consumers (pollers) of a given topic and calls the user-defined callback functions for message processing.

Data Types

cb_fun()

cb_fun() = fun((brod:partition(), brod:message() | brod:message_set(), cb_state()) -> cb_ret())

cb_ret()

cb_ret() = {ok, cb_state()} | {ok, ack, cb_state()}

cb_state()

cb_state() = term()

committed_offsets()

committed_offsets() = [{brod:partition(), brod:offset()}]

Function Index

ack/3Acknowledge that message has been sucessfully consumed.
code_change/3
handle_call/3
handle_cast/2
handle_info/2
init/1
start_link/6Start (link) a topic subscriber which receives and processes the messages from the given partition set.
start_link/7Start (link) a topic subscriber which receives and processes the messages or message sets from the given partition set.
start_link/8Start (link) a topic subscriber which receives and processes the messages from the given partition set.
stop/1Stop topic subscriber.
terminate/2

Function Details

ack/3

ack(Pid::pid(), Partition::brod:partition(), Offset::brod:offset()) -> ok

Acknowledge that message has been sucessfully consumed.

code_change/3

code_change(OldVsn, State, Extra) -> any()

handle_call/3

handle_call(Call, From, State) -> any()

handle_cast/2

handle_cast(Cast, State) -> any()

handle_info/2

handle_info(Info, State0) -> any()

init/1

init(X1) -> any()

start_link/6

start_link(Client::brod:client(), Topic::brod:topic(), Partitions::all | [brod:partition()], ConsumerConfig::brod:consumer_config(), CbModule::module(), CbInitArg::term()) -> {ok, pid()} | {error, any()}

Start (link) a topic subscriber which receives and processes the messages from the given partition set. Use atom 'all' to subscribe to all partitions. Messages are handled by calling CbModule:handle_message

start_link/7

start_link(Client::brod:client(), Topic::brod:topic(), Partitions::all | [brod:partition()], ConsumerConfig::brod:consumer_config(), MessageType::message | message_set, CbModule::module(), CbInitArg::term()) -> {ok, pid()} | {error, any()}

Start (link) a topic subscriber which receives and processes the messages or message sets from the given partition set. Use atom 'all' to subscribe to all partitions. Messages are handled by calling CbModule:handle_message

start_link/8

start_link(Client::brod:client(), Topic::brod:topic(), Partitions::all | [brod:partition()], ConsumerConfig::brod:consumer_config(), CommittedOffsets::committed_offsets(), MessageType::message | message_set, CbFun::cb_fun(), CbInitialState::cb_state()) -> {ok, pid()} | {error, any()}

Start (link) a topic subscriber which receives and processes the messages from the given partition set. Use atom 'all' to subscribe to all partitions. Messages are handled by calling the callback function.

NOTE: CommittedOffsets are the offsets for the messages that are successfully processed (acknoledged), not the begin-offset ot start fetching from.

stop/1

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

Stop topic subscriber.

terminate/2

terminate(Reason, State) -> any()


Generated by EDoc