POST /consumers/{string: group_name}

Creates a new consumer instance in the consumer group.

Description

Table 1. Parameters
Parameters Description
group_name (string) The name of the consumer group to join.
name (string) Name for the consumer instance, which will be used in URLs for the consumer. This must be unique, at least within the proxy process handling the request. If omitted, falls back on the automatically generated ID. Using automatically generated names is recommended for most use cases.
format (string) The format of consumed messages, which is used to convert messages into a JSON-compatible form. Valid values: “binary”, “avro”, “json”. If unspecified, defaults to “binary”.
auto.offset.reset (string) Sets the auto.offset.reset setting for the consumer. Values: latest, earliest, none
auto.commit.enable (string) Sets the auto.commit.enable setting for the consumer.
NOTE
You cannot set the time-to-live (TTL) for consumer instances or consumer groups. However, consumers can be configured to be deleted after some idle time. The amount of idle time before a consumer instance is automatically destroyed is set by the consumer.instance.timeout.ms property in the kafka-rest.properties file. See Configuration Parameters.

Syntax

http://<host>:8082/consumers/<group_name>

Request Example

curl -X POST -H "Content-Type: application/vnd.kafka.v2+json"
 --data '{"name":"user","format": "binary", "auto.offset.reset": "earliest"}'
 http://localhost:8082/consumers/grouptest

Response Example

The response JSON object is in the following form:
  • instance_id (string) – Unique ID for the consumer instance in this group. The instance_id is automatically generated if the name parameter is not specified.
  • base_uri (string) – Base URI used to construct URIs for subsequent requests against this consumer instance. This will be of the form http://hostname:port/consumers/consumer_group/instances/instance_id.
{
        "instance_id":"user",
        "base_uri":"http://localhost:8082/consumers/grouptest/instances/user"
}