Public | Automated Build

Last pushed: 2 years ago
Short Description
custom build of Kafka REST Proxy with schema cache patch
Full Description

Kafka REST Proxy

The Kafka REST Proxy provides a RESTful interface to a Kafka cluster. It makes
it easy to produce and consume messages, view the state of the cluster, and
perform administrative actions without using the native Kafka protocol or
clients. Examples of use cases include reporting data to Kafka from any
frontend app built in any language, ingesting messages into a stream processing
framework that doesn't yet support Kafka, and scripting administrative actions.


The following assumes you have Kafka, the schema registry, and an instance of
the REST Proxy running using the default settings and some topics already created.

# Get a list of topics
$ curl "http://localhost:8082/topics"

# Get info about one topic
$ curl "http://localhost:8082/topics/test"

# Produce a message using binary embedded data with value "Kafka" to the topic test
$ curl -X POST -H "Content-Type: application/vnd.kafka.binary.v1+json" \
      --data '{"records":[{"value":"S2Fma2E="}]}' "http://localhost:8082/topics/test"
  {"offsets":[{"partition": 3, "offset": 1}]}

# Produce a message using Avro embedded data, including the schema which will
# be registered with the schema registry and used to validate and serialize
# before storing the data in Kafka
$ curl -X POST -H "Content-Type: application/vnd.kafka.avro.v1+json" \
      --data '{"value_schema": "{\"type\": \"record\", \"name\": \"User\", \"fields\": [{\"name\": \"name\", \"type\": \"string\"}]}", "records": [{"value": {"name": "testUser"}}]}' \

# Create a consumer for binary data, starting at the beginning of the topic's
# log. Then consume some data from a topic using the base URL in the first response.
# Finally, close the consumer with a DELETE to make it leave the group and clean up
# its resources.
$ curl -X POST -H "Content-Type: application/vnd.kafka.v1+json" \
      --data '{"format": "binary", "auto.offset.reset": "smallest"}' \
$ curl -X GET -H "Accept: application/vnd.kafka.binary.v1+json" \
$ curl -X DELETE \
  # No content in response

# Create a consumer for Avro data, starting at the beginning of the topic's
# log. Then consume some data from a topic, which is decoded, translated to
# JSON, and included in the response. The schema used for deserialization is
# fetched automatically from the schema registry. Finally, clean up.
$ curl -X POST -H "Content-Type: application/vnd.kafka.v1+json" \
      --data '{"format": "avro", "auto.offset.reset": "smallest"}' \
$ curl -X GET -H "Accept: application/vnd.kafka.avro.v1+json" \
$ curl -X DELETE \
  # No content in response


You can download prebuilt versions of the Kafka REST Proxy as part of the
Confluent Platform. To install from source,
follow the instructions in the Development section.


The REST proxy includes a built-in Jetty server. The wrapper scripts
bin/kafka-rest-start and bin/kafka-rest-stop are the recommended method of
starting and stopping the service.


To build a development version, you may need a development versions of
rest-utils, and
schema-registry. After
installing these, you can build the Kafka REST Proxy
with Maven. All the standard lifecycle phases work.



The project is licensed under the Apache 2 license.

Docker Pull Command
Source Repository