Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete Kafka topic using Kafka REST Proxy?

How to delete Kafka topic using Kafka REST Proxy? I tried the following command, but it returns the error message:

curl -X DELETE XXX.XX.XXX.XX:9092/topics/test_topic

If it's impossible, then how to update delete the messages and update the scheme of a topic?

like image 421
Dinosaurius Avatar asked Jan 04 '17 11:01

Dinosaurius


People also ask

How does Kafka rest proxy work?

The REST Proxy is an HTTP-based proxy for your Kafka cluster. The API supports many interactions with your cluster, including producing and consuming messages and accessing cluster metadata such as the set of topics and mapping of partitions to brokers.


2 Answers

According to the documentation API Reference, you cannot delete topics via REST Proxy, and I agree with them because such a destructive operation should not be available via interface that is exposed to outside.

The topic deletion operation can be performed on the server where broker runs using command line utility. See How to Delete a topic in apache kafka

like image 157
Yuriy Tseretyan Avatar answered Nov 15 '22 07:11

Yuriy Tseretyan


You can update the schema for a message when you publish it using the POST /topics/(string: topic_name) REST endpoint. If the schema for the new messages is not backward compatible with the older messages in the same topic you will have to configure your Schema Registry to allow publishing of incompatible messages, otherwise you will get an error.

See the "Example Avro request" here: http://docs.confluent.io/3.1.1/kafka-rest/docs/api.html#post--topics-(string-topic_name)

See how to configure Schema Registry for forward, backward, or no compatibility see the documentation here: http://docs.confluent.io/3.1.1/schema-registry/docs/api.html#compatibility

like image 28
Hans Jespersen Avatar answered Nov 15 '22 06:11

Hans Jespersen