View Source kpro_brokers (kafka_protocol v4.1.8)

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.
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

Link to this function

connect_any(Endpoints0, Config)

View Source
-spec connect_any([endpoint()], config()) -> {ok, connection()} | {error, any()}.
Connect to any of the endpoints in the given list.
Link to this function

connect_controller(Bootstrap, Config, Opts)

View Source
-spec connect_controller(connection() | [endpoint()], config(), #{timeout => timeout()}) ->
                            {ok, connection()} | {error, any()}.
Connect to the controller broker of the kafka cluster.
Link to this function

connect_coordinator(Bootstrap, Config, Args)

View Source
-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
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()}.
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.
Link to this function

discover_coordinator(Connection, Type, Id, Timeout)

View Source
-spec discover_coordinator(connection(), coordinator_type(), group_id() | transactional_id(), timeout()) ->
                              {ok, endpoint()} | {error, any()}.
Discover group or transactional coordinator.
Link to this function

discover_partition_leader(Connection, Topic, Partition, Timeout)

View Source
-spec discover_partition_leader(connection(), topic(), partition(), timeout()) ->
                                   {ok, endpoint()} | {error, any()}.
Discover partition leader endpoint.
Link to this function

get_api_versions(Connection)

View Source
-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.
Link to this function

get_api_vsn_range(Connection, API)

View Source
-spec get_api_vsn_range(connection(), kpro:api()) -> {ok, kpro:vsn_range()} | {error, any()}.
Get API version range.
Link to this function

with_connection(Endpoints, Config, Fun)

View Source
-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.