View Source brod_kafka_request (brod v4.0.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

-type api() :: brod_kafka_apis:api().
-type conn() :: kpro:connection().
-type offset() :: brod:offset().
-type partition() :: brod:partition().
-type topic() :: brod:topic().
-type topic_config() :: kpro:struct().
-type vsn() :: brod_kafka_apis:vsn().

Functions

Link to this function

create_topics(Connection, TopicConfigs, RequestConfigs)

View Source
-spec create_topics(vsn() | conn(),
                    [topic_config()],
                    #{timeout => kpro:int32(), validate_only => boolean()}) ->
                       kpro:req().
Make a create_topics request.
Link to this function

delete_topics(Connection, Topics, Timeout)

View Source
-spec delete_topics(vsn() | conn(), [topic()], pos_integer()) -> kpro:req().
Make a delete_topics request.
Link to this function

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

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

join_group(Conn, Fields)

View Source
-spec join_group(conn(), kpro:struct()) -> kpro:req().
Make a join_group request.
-spec list_groups(conn()) -> kpro:req().
Make a list_groups request.
Link to this function

list_offsets(Connection, Topic, Partition, TimeOrSemanticOffset)

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

metadata(Connection, Topics)

View Source
-spec metadata(vsn() | conn(), all | [topic()]) -> kpro:req().
Make a metadata request.
Link to this function

offset_commit(Conn, Fields)

View Source
-spec offset_commit(conn(), kpro:struct()) -> kpro:req().
Make a offset_commit request.
Link to this function

offset_fetch(Connection, GroupId, Topics)

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

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

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

sync_group(Conn, Fields)

View Source
-spec sync_group(conn(), kpro:struct()) -> kpro:req().
Make a sync_group request.