cfg_key() = connect_timeout | client_id | extra_sock_opts | debug | nolink | query_api_versions | request_timeout | sasl | ssl
cfg_val() = term()
config() = [{cfg_key(), cfg_val()}] | #{cfg_key() => cfg_val()}
Connection configuration.
It is a tuple list or map with following keys (all of them are optional):connection_timeout: timeout (in ms) for the initial connection, defaults to 5 secondsclient_id: string representing the client in Kafka, defaults to "kpro-client"extra_sock_opts: extra options passed down to gen_tpc, defaults to []debug: debugging mode, defaults to falsenolink: whether not to link the kpro_connection process to the caller, defaults to falsequery_api_version: whether to query Kafka for supported API versions at the beginning,
so that kpro can use newer APIs; the ApiVersionRequest was introduced in Kafka 0.10,
so set this to false when using an older version of Kafka; defaults to truerequest_timeout: timeout (in ms) for the actual request, defaults to 4 minutessasl: configuration of SASL authentication, can be either {Mechanism, Username, Password}
or {Mechanism, File} or undefined, where Mechanism is plain | scram_sha_256 | scram_sha_512,
and File is the path to a text file which contains two lines, first line for username
and second line for password; defaults to undefinedssl: whether to use SSL, defaults to false, more information can be found in
brod documentationconnection() = pid()
hostname() = kpro:hostname()
portnum() = kpro:portnum()
| all_cfg_keys/0 | Return all config keys make client config management easy. |
| debug/2 | Enable/disable debugging on the socket process. |
| format_status/2 | |
| get_api_vsns/1 | |
| get_connect_timeout/1 | |
| get_endpoint/1 | |
| init/4 | |
| loop/2 | |
| request_async/2 | Send a request. |
| request_sync/3 | Send a request and wait for response for at most Timeout milliseconds. |
| send/2 | Same as @link request_async/2. |
| start/3 | Connect to the given endpoint. |
| stop/1 | Stop socket process. |
| system_code_change/4 | |
| system_continue/3 | |
| system_terminate/4 |
all_cfg_keys() -> [cfg_key()]
Return all config keys make client config management easy.
debug(Pid::connection(), File::print | string() | none) -> ok
Enable/disable debugging on the socket process. debug(Pid, pring) prints debug info on stdout debug(Pid, File) prints debug info into a File debug(Pid, none) stops debugging
format_status(Opt, Status) -> any()
get_api_vsns(Pid::pid()) -> {ok, undefined | kpro:vsn_ranges()} | {error, any()}
get_connect_timeout(Config::config()) -> timeout()
get_endpoint(Pid::pid()) -> {ok, kpro:endpoint()} | {error, any()}
init(Parent::pid(), Host::hostname(), Port::portnum(), Config::config()) -> no_return()
loop(State, Debug) -> any()
request_async(Pid::connection(), Request::kpro:req()) -> ok | {error, any()}
Send a request. Caller should expect to receive a response
having Rsp#kpro_rsp.ref the same as Request#kpro_req.ref
unless Request#kpro_req.no_ack is set to 'true'
request_sync(Pid::connection(), Request::kpro:req(), Timeout::timeout()) -> ok | {ok, kpro:rsp()} | {error, any()}
Send a request and wait for response for at most Timeout milliseconds.
send(Pid::connection(), Kpro_req::kpro:req()) -> ok
Same as @link request_async/2. Only that the message towards connection process is a cast (not a call), unless the request requires no ack from Kafka, in which case call is used to avoid message overflow. It always return 'ok'.
start(Host::hostname(), Port::portnum(), Config::config()) -> {ok, pid()} | {error, any()}
Connect to the given endpoint.
The started connection pid is linked to caller
unless nolink := true is found in Config
stop(Pid::connection()) -> ok | {error, any()}
Stop socket process.
system_code_change(State, Module, Vsn, Extra) -> any()
system_continue(Parent, Debug, State) -> any()
system_terminate(Reason::any(), Parent::term(), Debug::term(), Misc::term()) -> no_return()
Generated by EDoc