View Source kpro_brokers (kafka_protocol v4.1.9)
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()}.
-spec connect_controller(connection() | [endpoint()], config(), #{timeout => timeout()}) -> {ok, connection()} | {error, any()}.
-spec connect_coordinator(connection() | [endpoint()], config(), #{type => kpro:coordinator_type(), id => binary(), timeout => timeout()}) -> {ok, connection()} | {error, any()}.
Link to this function
connect_partition_leader(Bootstrap, Config, Topic, Partition, Opts)
View Source-spec connect_partition_leader(connection() | [endpoint()], config(), topic(), partition(), #{timeout => timeout()}) -> {ok, connection()} | {error, any()}.
-spec discover_coordinator(connection(), coordinator_type(), group_id() | transactional_id(), timeout()) -> {ok, endpoint()} | {error, any()}.
-spec get_api_versions(connection()) -> {ok, kpro:vsn_ranges()} | {error, any()}.
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()}.
-spec with_connection([endpoint()], config(), fun((connection()) -> Return)) -> Return when Return :: term().