

GitHub - confluentinc/kafka-rest: Confluent REST Proxy for Kafka
source link: https://github.com/confluentinc/kafka-rest
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
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.
Installation
You can download prebuilt versions of the Kafka REST Proxy as part of the Confluent Platform.
You can read our full installation instructions and the complete documentation
To install from source, follow the instructions in the Development section below.
Deployment
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.
Quickstart
The following assumes you have Kafka 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" ["__consumer_offsets","jsontest"] # Get info about one topic $ curl "http://localhost:8082/topics/jsontest" {"name":"jsontest","configs":{},"partitions":[{"partition":0,"leader":0,"replicas":[{"broker":0,"leader":true,"in_sync":true}]}]} # Produce a message with JSON data $ curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" \ --data '{"records":[{"value":{"name": "testUser"}}]}' \ "http://localhost:8082/topics/jsontest" {"offsets":[{"partition":0,"offset":3,"error_code":null,"error":null}],"key_schema_id":null,"value_schema_id":null} # Create a consumer for JSON data, starting at the beginning of the topic's # log. The consumer group is called "my_json_consumer" and the instance is "my_consumer_instance". $ curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" -H "Accept: application/vnd.kafka.v2+json" \ --data '{"name": "my_consumer_instance", "format": "json", "auto.offset.reset": "earliest"}' \ http://localhost:8082/consumers/my_json_consumer {"instance_id":"my_consumer_instance","base_uri":"http://localhost:8082/consumers/my_json_consumer/instances/my_consumer_instance"} # Subscribe the consumer to a topic $ curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" --data '{"topics":["jsontest"]}' \ http://localhost:8082/consumers/my_json_consumer/instances/my_consumer_instance/subscription # No content in response # Then consume some data from a topic using the base URL in the first response. $ curl -X GET -H "Accept: application/vnd.kafka.json.v2+json" \ http://localhost:8082/consumers/my_json_consumer/instances/my_consumer_instance/records [{"key":null,"value":{"name":"testUser"},"partition":0,"offset":3,"topic":"jsontest"}] # Finally, close the consumer with a DELETE to make it leave the group and clean up # its resources. $ curl -X DELETE -H "Accept: application/vnd.kafka.v2+json" \ http://localhost:8082/consumers/my_json_consumer/instances/my_consumer_instance # No content in response
Development
To build a development version, you may need a development versions of common, rest-utils, and schema-registry. After installing these, you can build the Kafka REST Proxy with Maven. All the standard lifecycle phases work.
Contribute
- Source Code: https://github.com/confluentinc/kafka-rest
- Issue Tracker: https://github.com/confluentinc/kafka-rest/issues
License
This project is licensed under the Confluent Community License.
Recommend
-
50
Confluent's Python Client for Apache KafkaTM confluent-kafka-python provides a high-level Producer, Consumer and AdminClient compatible with all Apache Kafka
-
93
README.md Docker Images for Confluent Plaform Docker images for deploying and running the Confluent Platform. The images are currently available on
-
71
README.md Schema Registry Schema Registry provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving Avro s...
-
41
README.md Confluent's .NET Client for Apache KafkaTM
-
23
README.md Confluent's Golang Client for Apache KafkaTM confluent-kafka-go is Confluent's Golang client for
-
20
Product Announcements Running Confluent Kafka on VMw...
-
11
Kafka、Eromanga与Confluent IPO 2021-06-27 原本想在Confluent IPO当天写这篇的,但得参加活动并准备《技术、商业与人》的试读运营与分发,所以,没有时间及时搞定这一篇,今天补上… Confluen...
-
7
About KAFKA and Confluent Apache Kafka is an open-source community distributed event streaming platform used by thousands of corporations for high-performance streaming, data pipelines, and critical applications. Ka...
-
5
Apache KafkaHow to make Apache Kafka clients go fast(er) on Confluent Cloud
-
3
Confluent之Kafka Connector初体验 Apache Kafka 是最大、最成功的开源项目之一...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK