kafka_ex v0.11.0 KafkaEx.New.KafkaExAPI 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

Link to this type

consumer_group_name()

View Source
consumer_group_name() :: binary()
Link to this type

correlation_id()

View Source
correlation_id() :: non_neg_integer()
Link to this type

error_atom()

View Source
error_atom() :: atom()
Link to this type

partition_id()

View Source
partition_id() :: non_neg_integer()
Link to this type

topic_name()

View Source
topic_name() :: binary()

Link to this section Functions

Link to this function

cluster_metadata(client)

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

Returns the cluster metadata from the given client

Link to this function

correlation_id(client)

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