Consumers

POST /consumers/{groupid}

Changed on

Creates a consumer instance in the given consumer group. You can optionally specify a consumer name and supported configuration options. It returns a base URI which must be used to construct URLs for subsequent requests against this consumer instance.

Request

  • The document declares no server URL.
  • Auth
    none declared

Request body

namestring

The unique name for the consumer instance. The name is unique within the scope of the consumer group. The name is used in URLs. If a name is not specified, a randomly generated name is assigned.

formatstring

The allowable message format for the consumer, which can be binary (default) or json. The messages are converted into a JSON format.

auto.offset.resetstring

Resets the offset position for the consumer. If set to latest (default), messages are read from the latest offset. If set to earliest, messages are read from the first offset.

fetch.min.bytesinteger

Sets the minimum amount of data, in bytes, for the consumer to receive. The broker waits until the data to send exceeds this amount. Default is 1 byte.

consumer.request.timeout.msinteger

Sets the maximum amount of time, in milliseconds, for the consumer to wait for messages for a request. If the timeout period is reached without a response, an error is returned. Default is 30000 (30 seconds).

enable.auto.commitboolean

If set to true (default), message offsets are committed automatically for the consumer. If set to false, message offsets must be committed manually.

isolation.levelstring

If set to read_uncommitted (default), all transaction records are retrieved, indpendent of any transaction outcome. If set to read_committed, the records from committed transactions are retrieved.

Example request

{
  "name": "consumer1",
  "format": "binary",
  "auto.offset.reset": "earliest",
  "enable.auto.commit": false,
  "fetch.min.bytes": 512,
  "consumer.request.timeout.ms": 30000,
  "isolation.level": "read_committed"
}

Response

Consumer created successfully.

instance_idstring

Unique ID for the consumer instance in the group.

base_uristring

Base URI used to construct URIs for subsequent requests against this consumer instance.

Example response

{
  "instance_id": "my-consumer",
  "base_uri": "http://localhost:8080/consumers/my-group/instances/my-consumer"
}

Changes

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the new optional request property