View Source brod_kafka_request (brod v4.4.0)

Helper functions for building request messages.

Summary

Functions

Make a delete_topics request.

Make a fetch request, If the first arg is a connection pid, call brod_kafka_apis:pick_version/2 to resolve version.

Make a join_group request.

Make a list_groups request.

Make a list_offsets request message for offset resolution. In kafka protocol, -2 and -1 are semantic 'time' to request for 'earliest' and 'latest' offsets. In brod implementation, -2, -1, 'earliest' and 'latest' are semantic 'offset', this is why often a variable named Offset is used as the Time argument.

Make a metadata request.

Make a offset_commit request.

Make a offset fetch request. NOTE: empty topics list only works for kafka 0.10.2.0 or later

Make a produce request, If the first arg is a connection pid, call brod_kafka_apis:pick_version/2 to resolve version.

Make a sync_group request.

Types

api/0

-type api() :: brod_kafka_apis:api().

conn/0

-type conn() :: kpro:connection().

offset/0

-type offset() :: brod:offset().

partition/0

-type partition() :: brod:partition().

topic/0

-type topic() :: brod:topic().

topic_config/0

-type topic_config() :: kpro:struct().

vsn/0

-type vsn() :: brod_kafka_apis:vsn().

Functions

create_topics(Connection, TopicConfigs, RequestConfigs)

-spec create_topics(vsn() | conn(),
                    [topic_config()],
                    #{timeout => kpro:int32(), validate_only => boolean()}) ->
                       kpro:req().

Make a create_topics request.

delete_topics(Connection, Topics, Timeout)

-spec delete_topics(vsn() | conn(), [topic()], pos_integer()) -> kpro:req().

Make a delete_topics request.

fetch(Pid, Topic, Partition, Offset, WaitTime, MinBytes, MaxBytes, IsolationLevel)

Make a fetch request, If the first arg is a connection pid, call brod_kafka_apis:pick_version/2 to resolve version.

join_group(Conn, Fields)

-spec join_group(conn(), kpro:struct()) -> kpro:req().

Make a join_group request.

list_groups(Connection)

-spec list_groups(conn()) -> kpro:req().

Make a list_groups request.

list_offsets(Connection, Topic, Partition, TimeOrSemanticOffset)

-spec list_offsets(conn(), topic(), partition(), brod:offset_time()) -> kpro:req().

Make a list_offsets request message for offset resolution. In kafka protocol, -2 and -1 are semantic 'time' to request for 'earliest' and 'latest' offsets. In brod implementation, -2, -1, 'earliest' and 'latest' are semantic 'offset', this is why often a variable named Offset is used as the Time argument.

metadata(Connection, Topics)

-spec metadata(vsn() | conn(), all | [topic()]) -> kpro:req().

Make a metadata request.

offset_commit(Conn, Fields)

-spec offset_commit(conn(), kpro:struct()) -> kpro:req().

Make a offset_commit request.

offset_fetch(Connection, GroupId, Topics)

-spec offset_fetch(conn(), brod:group_id(), Topics) -> kpro:req()
                      when Topics :: [{topic(), [partition()]}].

Make a offset fetch request. NOTE: empty topics list only works for kafka 0.10.2.0 or later

produce(MaybePid, Topic, Partition, BatchInput, RequiredAcks, AckTimeout, Compression)

-spec produce(conn() | vsn(),
              topic(),
              partition(),
              kpro:batch_input(),
              integer(),
              integer(),
              brod:compression()) ->
                 kpro:req().

Make a produce request, If the first arg is a connection pid, call brod_kafka_apis:pick_version/2 to resolve version.

sync_group(Conn, Fields)

-spec sync_group(conn(), kpro:struct()) -> kpro:req().

Make a sync_group request.