Kafka REST 2.0.1: GET /topics/{topic: string}/partitions/{partition_id: string}/messages?offset={int}[&count={int}]
Consumes messages from a partition of a topic.
Description
Depending on the configuration, the type of information retrieved has different behavior.
See the streams.default.stream
parameter in Kafka REST 2.0.1: Configuration Parameters.
Parameters Defined | Response |
---|---|
streams.default.stream is defined |
Consumes messages from a partition of a MapR-ES topic. The user could pass fully qualified topic name or not. If a fully qualified topic name is not used, messages are consumed from a partition of topic in the default stream path. |
streams.default.stream is not defined | Consumes messages from partition of MapR-ES topic. The user could only pass a fully qualified topic name that contains a stream path. |
Parameters | Description |
---|---|
topic_name (string) | Topic to consume the messages from. |
partition_id (int) | Partition to consume the messages from. |
offset (int) | Offset to start from. |
count (int) | Number of messages to consume (Optional). Default: 1 |
Syntax
http://<host>:8082/topics/<topic_name>/partitions/<partition_id>/messages?offset=<integer>[&count=<int>]
Request Example
curl -X GET "http://localhost:8082/topics/testtopic1/partitions/0/messages?offset=2&count=1"
Response Example
[{
"key":"a2v5",
"value":
"Y29uZmx1ZW50",
"topic":"/streaming_data/stream:testtopic1",
"partition":0,
"offset":2
}]