This is a work in progress RESTful interface to push messages to Apache Kafka and retrieve information and messages from it. It is built on the Play! framework using Scala.
Please note this has been developed against a single kafka instance and may not work correctly with a cluster.
Work has been inspired by the restful api proposal and mumrahs gist.
Suggestions, raised issues and pull requests are extremely welcome.
Update the configuration in conf/application.conf
# Kafka Settings
metadata.broker.list=["ubuntu:9092"]
zookeeper.connect="ubuntu:2181"
Run play from within the repository root.
play
Start the application.
run
The development site will default to http://localhost:9000/ and you can use something like postman to make requests.
###Get a list of topics###
####Request####
GET /
####Response####
{
"Ok": true,
"topics": [
"yourtopic1",
"yourtopic2"
]
}
###Get a list of partitions###
####Request#### GET /:topic
####Response####
{
"topic": "mytopic",
"partitions": [
0,
1
]
}
###Get a list of messages####
####Request####
GET /:topic/:partition
####Response####
[
{
"message1": {
"data": {}
}
},
{
"message2": {
"otherdata": {}
}
}
...
]
###Push a message into a partitioned topic###
####Request####
POST /:topic/:partition
{
"message1": { "data": {...} }
}
####Response####
200 OK