kayrock v0.1.1 Kayrock View Source
Documentation for Kayrock.
Link to this section Summary
Types
Represents an API response message
Specifies the version of an API message
A pid
for a Kayrock.BrokerConnection
process.
A pid
for a Kayrock.Client
process.
A broker's advertised integer node id
A node selector for sending messages to the cluster
Functions
Fetch the supported API versions from the cluster
Makes a synchronous call directly to a broker
Make an api call to a Kafka cluster mediated through a client
Create one or more topics
Link to this section Types
api_response()
View Source
api_response() :: map()
api_response() :: map()
Represents an API response message
This will generally be a generated struct.
api_version()
View Source
api_version() :: non_neg_integer()
api_version() :: non_neg_integer()
Specifies the version of an API message
Kayrock will generally try to pick a reasonable default here, but you can override it in many cases. See Kafka Protocol Documentation
broker_pid()
View Source
broker_pid() :: pid()
broker_pid() :: pid()
A pid
for a Kayrock.BrokerConnection
process.
This is for low-level communication with individual brokers. Generally you
should work with a client_pid
.
client_pid()
View Source
client_pid() :: pid()
client_pid() :: pid()
A pid
for a Kayrock.Client
process.
node_id()
View Source
node_id() :: integer()
node_id() :: integer()
A broker's advertised integer node id
node_selector()
View Source
node_selector() ::
node_id()
| :random
| :controller
| {:topic_partition, topic_name(), partition_id()}
node_selector() :: node_id() | :random | :controller | {:topic_partition, topic_name(), partition_id()}
A node selector for sending messages to the cluster
Generally the Kayrock API will select the right node depending on the operation. These are exposed to provide fine-grained user control in a few cases where it might make sense to override the default.
Possible values:
- Integer - Directly access a node by id. Generally you should not do this unless you are operating at a low level.
:random
- Select a node at random from the cluster metadata.:controller
- Select the controller node - this is used for cluster management messages
partition_id()
View Source
partition_id() :: non_neg_integer()
partition_id() :: non_neg_integer()
topic_name()
View Source
topic_name() :: binary()
topic_name() :: binary()
Link to this section Functions
api_versions(client_pid, version \\ 0, node_selector \\ :controller)
View Source
api_versions(client_pid(), api_version(), node_selector()) ::
{:ok, api_response()}
api_versions(client_pid(), api_version(), node_selector()) :: {:ok, api_response()}
Fetch the supported API versions from the cluster
Kayrock currently supports versions 0 and 1.
broker_sync_call(broker_pid, request)
View Source
broker_sync_call(pid(), Kayrock.Request.t()) :: {:ok, map()}
broker_sync_call(pid(), Kayrock.Request.t()) :: {:ok, map()}
Makes a synchronous call directly to a broker
broker_id
should be the pid of a Kayrock.BrokerConnection
. request
must
have an implementation for the Kayrock.Request
protocol.
client_call(client_pid, request, node_selector \\ :random)
View Source
client_call(client_pid(), Kayrock.Request.t(), node_selector()) ::
{:ok, api_response()}
client_call(client_pid(), Kayrock.Request.t(), node_selector()) :: {:ok, api_response()}
Make an api call to a Kafka cluster mediated through a client
create_topics(client_pid, topics, timeout \\ -1, version \\ 2, node_selector \\ :controller) View Source
Create one or more topics