class OffsetFetchRequest

Header File: <libkafka_asio/offset_fetch_request.h>

Namespace: libkafka_asio

Implementation of the Kafka OffsetFetchRequest as described on the Kafka wiki. Offset fetch requests are used to retrieve an offset value for one or more topic partitions of a Kafka consumer group. These kinds of requests require Kafka version or above. Offset fetch requests must be sent to the current offset coordinator broker, which can be discovered using a ConsumerMetadata request.

Member Functions


void FetchOffset(const String& topic_name,
                 Int32 partition)

Fetch offset data for the given topic partition


void set_consumer_group(const String& consumer_group)

Set the consumer group to fetch the offset data for.


const Topics& topics() const

Returns a reference to the list of topics of this offset fetch request. This method is mainly used internally for getting the request data during the conversion to the Kafka wire format.


const String& consumer_group() const

Returns the consumer group string of this offset-fetch request.



struct Topic {
    String      topic_name;
    Partitions  partitions;
  • topic_name: Name of the topic to fetch data for.
  • partitions: Set of partitions of this topic.


struct Partition {
    Int32 partition;
  • partition: Number, identifying this topic partition.


typedef std::vector<Topic> Topics

Vector of Topic objects.


typedef std::vector<Partition> Partitions

Vector of Partition objects.


typedef OffsetFetchResponse ResponseType

Type of the response object of an offset fetch request.


typedef MutableOffsetFetchResponse MutableResponseType

Type of a mutable response object for a offset fetch request. This type is used by the library at when reading-in the response from a Kafka server.