View Source kpro_brokers (kafka_protocol v4.2.4)
Summary
Functions
Connect to any of the endpoints in the given list.
Connect to the controller broker of the kafka cluster.
Connect group or transaction coordinator. If the first arg is not a connection pid but a list of bootstrapping endpoints, it will first try to connect to any of the nodes NOTE: 'txn' type only applicable to kafka 0.11 or later
Connect partition leader. If the fist arg is not an already established metadata connection but a bootstrapping endpoint list, this function will first try to establish a temp connection to any of the bootstrapping endpoints. Then send metadata request to discover partition leader broker Finally connect to the leader broker.
Discover group or transactional coordinator.
Discover partition leader endpoint.
Qury API version ranges using the given kpro_connection
pid. The return value is an intersection of queried version ranges and version ranges supported in THIS library.
Get API version range.
Evaluate given function with a connection to any of the nodes in in the given endpoints. Raise a 'throw' exception if failed to connect all endpoints.
Types
-type config() :: kpro_connection:config().
-type connection() :: kpro:connection().
-type coordinator_type() :: kpro:coordinator_type().
-type endpoint() :: kpro:endpoint().
-type group_id() :: kpro:group_id().
-type partition() :: kpro:partition().
-type topic() :: kpro:topic().
-type transactional_id() :: kpro:transactional_id().
Functions
-spec connect_any([endpoint()], config()) -> {ok, connection()} | {error, any()}.
Connect to any of the endpoints in the given list.
-spec connect_controller(connection() | [endpoint()], config(), #{timeout => timeout()}) -> {ok, connection()} | {error, any()}.
Connect to the controller broker of the kafka cluster.
-spec connect_coordinator(connection() | [endpoint()], config(), #{type => kpro:coordinator_type(), id => binary(), timeout => timeout()}) -> {ok, connection()} | {error, any()}.
Connect group or transaction coordinator. If the first arg is not a connection pid but a list of bootstrapping endpoints, it will first try to connect to any of the nodes NOTE: 'txn' type only applicable to kafka 0.11 or later
-spec connect_partition_leader(connection() | [endpoint()], config(), topic(), partition(), #{timeout => timeout()}) -> {ok, connection()} | {error, any()}.
Connect partition leader. If the fist arg is not an already established metadata connection but a bootstrapping endpoint list, this function will first try to establish a temp connection to any of the bootstrapping endpoints. Then send metadata request to discover partition leader broker Finally connect to the leader broker.
-spec discover_coordinator(connection(), coordinator_type(), group_id() | transactional_id(), timeout()) -> {ok, endpoint()} | {error, any()}.
Discover group or transactional coordinator.
-spec discover_partition_leader(connection(), topic(), partition(), timeout()) -> {ok, endpoint()} | {error, any()}.
Discover partition leader endpoint.
-spec get_api_versions(connection()) -> {ok, kpro:vsn_ranges()} | {error, any()}.
Qury API version ranges using the given kpro_connection
pid. The return value is an intersection of queried version ranges and version ranges supported in THIS library.
-spec get_api_vsn_range(connection(), kpro:api()) -> {ok, kpro:vsn_range()} | {error, any()}.
Get API version range.
-spec with_connection([endpoint()], config(), fun((connection()) -> Return)) -> Return when Return :: term().
Evaluate given function with a connection to any of the nodes in in the given endpoints. Raise a 'throw' exception if failed to connect all endpoints.