{
"name" : "consumer1",
"format" : "binary",
"auto.offset.reset" : "earliest",
"enable.auto.commit" : false,
"fetch.min.bytes" : 512,
"consumer.request.timeout.ms" : 30000
}
The Strimzi HTTP Bridge for Apache Kafka provides a REST API for integrating HTTP based client applications with a Kafka cluster. You can use the API to create and manage consumers and send and receive records over HTTP rather than the native Kafka protocol.
Version : 0.1.0
Contact Email : strimzi@redhat.com
License : Apache 2.0
License URL : http://www.apache.org/licenses/LICENSE-2.0.html
Terms of service : http://swagger.io/terms/
Host : bridge.swagger.io
BasePath : /
Schemes : HTTP
Consumers : Consumer operations to create consumers in your Kafka cluster and perform common actions, such as subscribing to topics, retrieving processed records, and committing offsets.
Producer : Producer operations to send records to a specified topic or topic partition.
Seek : Seek operations that enable a consumer to begin receiving messages from a given offset position.
Topics : Topic operations to send messages to a specified topic or topic partition. You can include message keys in requests.
application/json
application/json
Type : < string, < integer (int32) > array > map
Name | Description | Schema |
---|---|---|
auto.offset.reset |
Resets the offset position for the consumer.
If set to |
string |
consumer.request.timeout.ms |
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. |
integer |
enable.auto.commit |
If set to |
boolean |
fetch.min.bytes |
Sets the minimum ammount of data, in bytes, for the consumer to receive. The broker waits until the data to send exceeds this amount. |
integer |
format |
The allowable message format for the consumer, which can be |
string |
name |
The unique name for the consumer instance. The name is unique within the scope of the consumer group. The name is used in URLs. |
string |
Name | Schema |
---|---|
key |
string |
offset |
integer (int64) |
partition |
integer (int32) |
topic |
string |
value |
string |
Type : < ConsumerRecord > array
Name | Description | Schema |
---|---|---|
base_uri |
Base URI used to construct URIs for subsequent requests against this consumer instance. |
string |
instance_id |
Unique ID for the consumer instance in the group. |
string |
Name | Schema |
---|---|
error_code |
integer (int32) |
message |
string |
Name | Schema |
---|---|
offset |
integer (int64) |
partition |
integer (int32) |
topic |
string |
Name | Schema |
---|---|
offsets |
< OffsetCommitSeek > array |
Name | Schema |
---|---|
offset |
integer (int64) |
partition |
integer (int32) |
Name | Schema |
---|---|
offsets |
< OffsetRecordSent > array |
Name | Schema |
---|---|
partition |
integer (int32) |
topic |
string |
Name | Schema |
---|---|
partitions |
< Partition > array |
Name | Schema |
---|---|
partition |
integer (int32) |
Name | Schema |
---|---|
records |
< ProducerRecord > array |
Type : object
Name | Schema |
---|---|
records |
< ProducerRecordToPartition > array |
Name | Schema |
---|---|
partitions |
< AssignedTopicPartitions > array |
topics |
Name | Description | Schema |
---|---|---|
topic_pattern |
A regex topic pattern for matching multiple topics |
string |
topics |
< string > array |
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.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group in which to create the consumer. |
string |
Body |
body |
Name and configuration of the consumer. The name is unique within the scope of the consumer group. If a name is not specified, a randomly generated name is assigned. All parameters are optional. The supported configuration options are shown in the following example. |
HTTP Code | Description | Schema |
---|---|---|
200 |
Consumer created successfully. |
|
409 |
A consumer instance with the specified name already exists in the Kafka Bridge. |
|
422 |
One or more consumer configuration options have invalid values. |
application/vnd.kafka.v2+json
application/vnd.kafka.v2+json
Consumers
{
"name" : "consumer1",
"format" : "binary",
"auto.offset.reset" : "earliest",
"enable.auto.commit" : false,
"fetch.min.bytes" : 512,
"consumer.request.timeout.ms" : 30000
}
{
"application/vnd.kafka.v2+json" : {
"instance_id" : "consumer1",
"base_uri" : "http://localhost:8080/consumers/my-group/instances/consumer1"
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 409,
"message" : "A consumer instance with the specified name already exists in the Kafka Bridge."
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 422,
"message" : "One or more consumer configuration options have invalid values."
}
}
Deletes a specified consumer instance. The request for this operation MUST use the base URL (including the host and port) returned in the response from the POST
request to /consumers/{groupid}
that was used to create this consumer.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the consumer belongs. |
string |
Path |
name |
Name of the consumer that you want to delete. |
string |
HTTP Code | Description | Schema |
---|---|---|
204 |
Consumer removed successfully. |
No Content |
404 |
The specified consumer instance was not found. |
application/vnd.kafka.v2+json
application/vnd.kafka.v2+json
Consumers
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
Assigns one or more topic partitions to a consumer.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the consumer belongs. |
string |
Path |
name |
Name of the consumer to which you want to assign topic partitions. |
string |
Body |
body |
List of topic partitions to assign to the consumer. |
HTTP Code | Description | Schema |
---|---|---|
204 |
Partitions assigned successfully. |
No Content |
404 |
The specified consumer instance was not found. |
|
409 |
Subscriptions to topics, partitions, and patterns are mutually exclusive. |
application/vnd.kafka.v2+json
application/vnd.kafka.v2+json
Consumers
{
"partitions" : [ {
"topic" : "topic",
"partition" : 0
}, {
"topic" : "topic",
"partition" : 1
} ]
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 409,
"message" : "Subscriptions to topics, partitions, and patterns are mutually exclusive."
}
}
Commits a list of consumer offsets. To commit offsets for all records fetched by the consumer, leave the request body empty.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the consumer belongs. |
string |
Path |
name |
Name of the consumer. |
string |
Body |
body |
List of consumer offsets to commit to the consumer offsets commit log. You can specify one or more topic partitions to commit offsets for. |
HTTP Code | Description | Schema |
---|---|---|
204 |
Commit made successfully. |
No Content |
404 |
The specified consumer instance was not found. |
application/vnd.kafka.v2+json
application/vnd.kafka.v2+json
Consumers
{
"offsets" : [ {
"topic" : "topic",
"partition" : 0,
"offset" : 15
}, {
"topic" : "topic",
"partition" : 1,
"offset" : 42
} ]
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
Configures a subscribed consumer to fetch offsets from a particular offset the next time it fetches a set of records from a given topic partition. This overrides the default fetch behavior for consumers. You can specify one or more topic partitions.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the consumer belongs. |
string |
Path |
name |
Name of the subscribed consumer. |
string |
Body |
body |
List of partition offsets from which the subscribed consumer will next fetch records. |
HTTP Code | Description | Schema |
---|---|---|
204 |
Seek performed successfully. |
No Content |
404 |
The specified consumer instance was not found, or the specified consumer instance did not have one of the specified partitions assigned. |
application/vnd.kafka.v2+json
application/vnd.kafka.v2+json
Consumers
Seek
{
"offsets" : [ {
"topic" : "topic",
"partition" : 0,
"offset" : 15
}, {
"topic" : "topic",
"partition" : 1,
"offset" : 42
} ]
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
Configures a subscribed consumer to seek (and subsequently read from) the first offset in one or more given topic partitions.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the subscribed consumer belongs. |
string |
Path |
name |
Name of the subscribed consumer. |
string |
Body |
body |
List of topic partitions to which the consumer is subscribed. The consumer will seek the first offset in the specified partitions. |
HTTP Code | Description | Schema |
---|---|---|
204 |
Seek to the beginning performed successfully. |
No Content |
404 |
The specified consumer instance was not found, or the specified consumer instance did not have one of the specified partitions assigned. |
application/vnd.kafka.v2+json
application/vnd.kafka.v2+json
Consumers
Seek
{
"partitions" : [ {
"topic" : "topic",
"partition" : 0
}, {
"topic" : "topic",
"partition" : 1
} ]
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
Configures a subscribed consumer to seek (and subsequently read from) the offset at the end of one or more of the given topic partitions.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the subscribed consumer belongs. |
string |
Path |
name |
Name of the subscribed consumer. |
string |
Body |
body |
List of topic partitions to which the consumer is subscribed. The consumer will seek the last offset in the specified partitions. |
HTTP Code | Description | Schema |
---|---|---|
204 |
Seek to the end performed successfully. |
No Content |
404 |
The specified consumer instance was not found, or the specified consumer instance did not have one of the specified partitions assigned. |
application/vnd.kafka.v2+json
application/vnd.kafka.v2+json
Consumers
Seek
{
"partitions" : [ {
"topic" : "topic",
"partition" : 0
}, {
"topic" : "topic",
"partition" : 1
} ]
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
Retrieves records for a subscribed consumer, including message values, topics, and partitions. The request for this operation MUST use the base URL (including the host and port) returned in the response from the POST
request to /consumers/{groupid}
that was used to create this consumer.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the subscribed consumer belongs. |
string |
Path |
name |
Name of the subscribed consumer for which you want to retrieve records. |
string |
Query |
max_bytes |
The maximum size, in bytes, of unencoded keys and values that can be included in the response. Otherwise, an error response with code 422 is returned. |
integer |
Query |
timeout |
The maximum amount of time, in milliseconds, that the HTTP Bridge spends retrieving records before timing out the request. |
integer |
HTTP Code | Description | Schema |
---|---|---|
200 |
Poll request executed successfully. |
|
404 |
The specified consumer instance was not found. |
|
406 |
The |
|
422 |
Response exceeds the maximum number of bytes the consumer can receive |
application/vnd.kafka.json.v2+json
application/vnd.kafka.binary.v2+json
application/vnd.kafka.v2+json
Consumers
{
"application/vnd.kafka.json.v2+json" : [ {
"topic" : "topic",
"key" : "key1",
"value" : {
"foo" : "bar"
},
"partition" : 0,
"offset" : 2
}, {
"topic" : "topic",
"key" : "key2",
"value" : [ "foo2", "bar2" ],
"partition" : 1,
"offset" : 3
} ],
"application/vnd.kafka.binary.v2+json" : "[\n {\n \"topic\": \"test\",\n \"key\": \"a2V5\",\n \"value\": \"Y29uZmx1ZW50\",\n \"partition\": 1,\n \"offset\": 100,\n },\n {\n \"topic\": \"test\",\n \"key\": \"a2V5\",\n \"value\": \"a2Fma2E=\",\n \"partition\": 2,\n \"offset\": 101,\n }\n]"
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 406,
"message" : "The `format` used in the consumer creation request does not match the embedded format in the Accept header of this request."
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 422,
"message" : "Response exceeds the maximum number of bytes the consumer can receive"
}
}
Subscribes a consumer to one or more topics. You can describe the topics to which the consumer will subscribe in a list (of Topics
type) or as a topic_pattern
field. Each call replaces the subscriptions for the subscriber.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the subscribed consumer belongs. |
string |
Path |
name |
Name of the consumer that you want to unsubscribe from topics. |
string |
Body |
body |
List of topics to which the consumer will subscribe. |
HTTP Code | Description | Schema |
---|---|---|
204 |
Consumer subscribed successfully. |
No Content |
404 |
The specified consumer instance was not found. |
|
409 |
Subscriptions to topics, partitions, and patterns are mutually exclusive. |
|
422 |
A list (of |
application/vnd.kafka.v2+json
application/vnd.kafka.v2+json
Consumers
{
"topics" : [ "topic1", "topic2" ]
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 409,
"message" : "Subscriptions to topics, partitions, and patterns are mutually exclusive."
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 422,
"message" : "A list (of Topics type) or a topic_pattern must be specified."
}
}
Retrieves a list of the topics to which the consumer is subscribed.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the subscribed consumer belongs. |
string |
Path |
name |
Name of the consumer that you want to unsubscribe from topics. |
string |
HTTP Code | Description | Schema |
---|---|---|
200 |
List of subscribed topics and partitions. |
|
404 |
The specified consumer instance was not found. |
application/vnd.kafka.v2+json
Consumers
{
"topics" : [ "my-topic1", "my-topic2" ],
"partitions" : [ {
"my-topic1" : [ 1, 2, 3 ]
}, {
"my-topic2" : [ 1 ]
} ]
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
}
Unsubscribes a consumer from all topics.
Type | Name | Description | Schema |
---|---|---|---|
Path |
groupid |
ID of the consumer group to which the subscribed consumer belongs. |
string |
Path |
name |
Name of the consumer that you want to unsubscribe from topics. |
string |
HTTP Code | Description | Schema |
---|---|---|
204 |
Consumer unsubscribed successfully. |
No Content |
404 |
The specified consumer instance was not found. |
Consumers
{
"error_code" : 404,
"message" : "The specified consumer instance was not found."
}
Check if the bridge is running. This does not necessarily imply that it is ready to accept requests.
HTTP Code | Description | Schema |
---|---|---|
200 |
The bridge is healthy |
No Content |
Retrieves the OpenAPI v2 specification in JSON format.
HTTP Code | Description | Schema |
---|---|---|
200 |
OpenAPI v2 specification in JSON format retrieved successfully. |
string |
application/json
Check if the bridge is ready and can accept requests.
HTTP Code | Description | Schema |
---|---|---|
200 |
The bridge is ready |
No Content |
Sends one or more records to a given topic, optionally specifying a partition, key, or both.
Type | Name | Description | Schema |
---|---|---|---|
Path |
topicname |
Name of the topic to which you want to send records. |
string |
Body |
body |
HTTP Code | Description | Schema |
---|---|---|
200 |
Records sent successfully. |
|
404 |
The specified topic was not found. |
|
422 |
The record list is not valid. |
application/vnd.kafka.json.v2+json
application/vnd.kafka.binary.v2+json
application/vnd.kafka.v2+json
Producer
Topics
{
"records" : [ {
"key" : "key1",
"value" : "value1"
}, {
"value" : "value2",
"partition" : 1
}, {
"value" : "value3"
} ]
}
{
"application/vnd.kafka.v2+json" : {
"offsets" : [ {
"partition" : 2,
"offset" : 0
}, {
"partition" : 1,
"offset" : 1
}, {
"partition" : 2,
"offset" : 2
} ]
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified topic was not found."
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 422,
"message" : "The record list contains invalid records."
}
}
Sends one or more records to a given topic partition, optionally specifying a key.
Type | Name | Description | Schema |
---|---|---|---|
Path |
partitionid |
ID of the partition to which you want to send records. |
integer |
Path |
topicname |
Name of the topic containing the partition to which you want to send records. |
string |
Body |
body |
List of records to send to a given topic partition, including a value (required) and a key (optional). |
HTTP Code | Description | Schema |
---|---|---|
200 |
Records sent successfully. |
|
404 |
The specified topic partition was not found. |
|
422 |
The record is not valid. |
application/vnd.kafka.json.v2+json
application/vnd.kafka.binary.v2+json
application/vnd.kafka.v2+json
Producer
Topics
{
"records" : [ {
"key" : "key1",
"value" : "value1"
}, {
"value" : "value2"
} ]
}
{
"application/vnd.kafka.v2+json" : {
"offsets" : [ {
"partition" : 2,
"offset" : 0
}, {
"partition" : 1,
"offset" : 1
}, {
"partition" : 2,
"offset" : 2
} ]
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 404,
"message" : "The specified topic partition was not found."
}
}
{
"application/vnd.kafka.v2+json" : {
"error_code" : 422,
"message" : "The record is not valid."
}
}
Revised on 2019-12-02 20:54:48 +0100