KafkaEx.New.KafkaExAPI (kafka_ex v0.12.1) View Source

This module interfaces Kafka through the New.Client implementation

This is intended to become the future KafkaEx API

Most functions here take a client pid as the first argument.

{:ok, client} = KafkaEx.New.Client.start_link()

KafkaEx.New.KafkaExAPI.latest_offset(client, "some_topic", 0)

Link to this section Summary

Functions

Returns the cluster metadata from the given client

Returns the current correlation id for the given client

Fetch the latest offset for a given partition

Set the consumer group name that will be used by the given client for autocommit

Get topic metadata for the given topics

Link to this section Types

Specs

client() :: GenServer.server()

Specs

consumer_group_name() :: binary()

Specs

correlation_id() :: non_neg_integer()

Specs

error_atom() :: atom()

Specs

node_id() :: non_neg_integer()

Specs

offset() :: non_neg_integer()

Specs

partition_id() :: non_neg_integer()

Specs

topic_name() :: binary()

Link to this section Functions

Link to this function

cluster_metadata(client)

View Source

Specs

cluster_metadata(client()) :: {:ok, KafkaEx.New.ClusterMetadata.t()}

Returns the cluster metadata from the given client

Specs

correlation_id(client()) :: {:ok, correlation_id()}

Returns the current correlation id for the given client

Link to this function

latest_offset(client, topic, partition)

View Source

Specs

latest_offset(client(), topic_name(), partition_id()) ::
  {:error, error_atom()} | {:ok, offset()}

Fetch the latest offset for a given partition

Link to this function

set_consumer_group_for_auto_commit(client, consumer_group)

View Source

Specs

set_consumer_group_for_auto_commit(client(), consumer_group_name()) ::
  :ok | {:error, :invalid_consumer_group}

Set the consumer group name that will be used by the given client for autocommit

NOTE this function will not be supported after the legacy API is removed

Link to this function

topics_metadata(client, topics, allow_topic_creation \\ false)

View Source

Specs

topics_metadata(client(), [topic_name()], boolean()) ::
  {:ok, [KafkaEx.New.Topic.t()]}

Get topic metadata for the given topics

Always calls out to the broker to get the most up-to-date metadata (and subsequently updates the client's state with the updated metadata). Set allow_topic_creation to true to allow the topics to be created if they don't exist