GET /topics/{topic: string}/partition/{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 and rest.proxy.backend parameters in Configuration Parameters.

Table 1. Response Behavior
Parameters Defined Response
streams.default.stream is defined

Consumes messages from a partition of a MapR Streams 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 and rest.proxy.backend=streams Consumes messages from partition of MapR Streams topic. The user could only pass a fully qualified topic name that contains a stream path.
streams.default.stream is not defined and rest.proxy.backend=hybrid Consumes messages from partition of MapR Streams topic if the topic name starts with a forward slash (/) and a colon (:). Otherwise, consumes messages by from a partition of an Apache Kafka topic
Table 2. Parameters
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>/partition/<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
}]