class OffsetResponse
Header File: <libkafka_asio/offset_response.h>
Namespace: libkafka_asio
Implementation of the Kafka OffsetResponse as described on the Kafka wiki. An object of this type will be given as response object to the handler function when invoking an offset request.
Member Functions
TopicPartitionOffset
Topic::Partition::OptionalType TopicPartitionOffset(const String& topic_name,
Int32 partition) const
Search for offset data for the given topic partition inside this response object. If no such data can be found, the return value is empty.
// Assume the response is an argument of the request handler function
OffsetResponse::OptionalType response;
// Get the offset data for topic 'foo' partition 1
OffsetResponse::Topic::Partition::OptionalType offsets;
offsets = response->TopicPartitionOffset("foo", 1);
if (offsets)
{
// [...]
}
topics
const TopicVector& topics() const
Returns a reference to the set of topics, offsets have been received for.
Types
Topic
struct Topic
topic_name
: Name of the topic to fetch data for.partition_offsets
: Set of partitions of this topic for which offset data has been received.
Topic::Partition
struct Topic::Partition
partition
: Number, identifying this topic partition.error_code
: Kafka error for this topic partition.offsets
: Vector of offsets (std::vector<Int64>
) received for this topic partition.
TopicVector
typedef std::vector<Topic> TopicVector
Vector of Topic
structures.
OptionalType
typedef boost::optional<OffsetResponse> OptionalType
A offset response object wrapped using Boost optional. Such an object will be used for offset request handler functions.