Module kpro_connection

Data Types

cfg_key()

cfg_key() = connect_timeout | client_id | extra_sock_opts | debug | nolink | query_api_versions | request_timeout | sasl | ssl

cfg_val()

cfg_val() = term()

config()

config() = [{cfg_key(), cfg_val()}] | #{cfg_key() => cfg_val()}

connection()

connection() = pid()

hostname()

hostname() = kpro:hostname()

portnum()

portnum() = kpro:portnum()

Function Index

all_cfg_keys/0Return all config keys make client config management easy.
debug/2Enable/disable debugging on the socket process.
format_status/2
get_api_vsns/1
get_endpoint/1
init/4
loop/2
request_async/2Send a request.
request_sync/3Send a request and wait for response for at most Timeout milliseconds.
send/2Same as @link request_async/2.
start/3Connect to the given endpoint.
stop/1Stop socket process.
system_code_change/4
system_continue/3
system_terminate/4

Function Details

all_cfg_keys/0

all_cfg_keys() -> [cfg_key()]

Return all config keys make client config management easy.

debug/2

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/2

format_status(Opt, Status) -> any()

get_api_vsns/1

get_api_vsns(Pid::pid()) -> {ok, undefined | kpro:vsn_ranges()} | {error, any()}

get_endpoint/1

get_endpoint(Pid::pid()) -> {ok, kpro:endpoint()} | {error, any()}

init/4

init(Parent::pid(), Host::hostname(), Port::portnum(), Config::config()) -> no_return()

loop/2

loop(State, Debug) -> any()

request_async/2

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/3

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/2

send(Pid::connection(), Request::kpro:req()) -> ok

Same as @link request_async/2. Only that the message towards connection process is a cast (not a call). Always return 'ok'.

start/3

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/1

stop(Pid::connection()) -> ok | {error, any()}

Stop socket process.

system_code_change/4

system_code_change(State, Module, Vsn, Extra) -> any()

system_continue/3

system_continue(Parent, Debug, State) -> any()

system_terminate/4

system_terminate(Reason::any(), Parent::term(), Debug::term(), Misc::term()) -> no_return()


Generated by EDoc