• Stars
    star
    154
  • Rank 237,105 (Top 5 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Apache Kafka HTTP Endpoint for producing and consuming messages from topics

dropwizard-kafka-http

This project creates an Apache Kafka HTTP endpoint for producing and consuming messages. It is built on the Dropwizard framework that makes Java REST services operator-friendly and easy to deploy.

Running in Development with Vagrant

A Vagrantfile is included in the project to quickly get up and running with virtual machines to run ZooKeeper, Kafka, and the HTTP endpoint.

  1. Install Vagrant http://www.vagrantup.com/
  2. Install Virtual Box https://www.virtualbox.org/
  3. git clone https://github.com/stealthly/dropwizard-kafka-http
  4. cd dropwizard-kafka-http
  5. vagrant up
  6. curl -d "topic=http&message=hello&key=0" "http://192.168.22.10:8080/message"
  7. curl "http://192.168.22.10:8080/message?topic=http"

Your original message produced from the consumer:

[{"topic":"http","key":"0","message":"hello","partition":0,"offset":0}]
  • Zookeeper will be running on 192.168.22.5
  • dropwizard-kafka-http is built cleanly before Zookeeper installs in vagrant/zk.sh
  • Kafka Broker One is running on 192.168.22.10
  • dropwizard-kafka-http launches on 192.168.22.10 after the Kafka Broker starts in vagrant/broker.sh

If you want you can log in to the machines using vagrant ssh zookeeper and vagrant ssh brokerOne.

Running in Your Own Environments

For deployment, you'll need to build the project with Maven. Dropwizard projects produce "fat jars" so that you'll get a standalone binary ready to distribute and run with your production Java runtime. Assuming that ZooKeeper and Kafka are already running, edit the included kafka-http.yml to reflect the appropriate addresses for the HTTP endpoint to connect to these services.

Then, use the standard server Dropwizard command to start up the HTTP server on port 8080, passing the config file as argument:

$ mvn package
$ java -jar target/dropwizard-kafka-http-0.0.1-SNAPSHOT.jar server kafka-http.yml
$ curl -d "topic=http&message=hello&key=0" http://localhost:8080/message
$ curl "http://localhost:8080/message?topic=http"

You will also find an operator's interface with metrics and other info on port 8081.

It is recommended that you run the process under your preferred init or service supervision tool. See the Dropwizard configuration reference for extensive customization options for the HTTP server, logging, etc.

dropwizard-kafka-http api methods

Produce messages

POST /message

topic=$topic

message=$message0
key=$key0

message=$message1
key=$key1, ... etc

Produces messages on topic.

Parameters:
topic   - required topic name
key     - optional key text. Multiple values are possible
message - required message text. Multiple values are possible

Note: if keys are passed, then passed keys count should match messages count.

Errors:
400     - wrong parameters passed

Consume messages

GET /message?topic=$topic&timeout=$timeout
Returns consumed messages available on topic.

Parameters:
topic   - required topic name
timeout - optional timeout in ms

Errors:
400     - wrong parameters passed

More Repositories

1

scala-kafka

Quick up and running using Scala for Apache Kafka
Scala
331
star
2

go_kafka_client

Apache Kafka Client Library for Go
Go
276
star
3

go-avro

Apache Avro for Golang
Go
129
star
4

xml-avro

Generate Avro schema and Avro binary from XSD schema and XML
Java
66
star
5

siesta

Making support for Apache Kafka in Go better
Go
55
star
6

go-zipkin

Zipkin tracing library for Go
Go
42
star
7

zipkin-mesos-framework

Zipkin Mesos Framework
Scala
31
star
8

go-kafka-avro

go-kafka-avro implements Avro encoding and decoding compatible with Confluent Schema Registry.
Go
28
star
9

go-kafka

Quick up and running using Go for Apache Kafka
Go
22
star
10

syslog-kafka

Syslog Producer for Apache Kafka
Go
21
star
11

stack-deploy

Apache Mesos Platform as a Service Deploy
Go
21
star
12

syscol

Collect local Mesos slave, underlying operating system and machine metrics and produce to Apache Kafka
Go
20
star
13

datastax-enterprise-mesos

DataStax Enterprise on Mesos
Scala
15
star
14

hdfs-mesos

Apache Hadoop HDFS Data Node Scheduler
Java
13
star
15

go-mesos-utils

Go based utilities for working with Apache Mesos Frameworks
Go
12
star
16

alligator

Custom allocator modules for Apache Mesos
C++
6
star
17

zeppelin-notebooks

Apache Zeppelin notebooks for YCSB
Shell
6
star
18

statsd-mesos-kafka

Mesos Statsd Framework that sends its metrics to Apache Kafka
Go
5
star
19

java-kafka

Log and Metric Reporters For Apache Kafka
Java
5
star
20

gonzo

Go Mesos Kafka Consumer
Go
4
star
21

ulysses

Go Network Security
Go
4
star
22

cloud-deploy-grid

A cloud portable deployment utility for spinning up and managing virtual machines of Apache Mesos and DCOS
Python
4
star
23

sawfly

Elodina Open Source Platform as a Service Software
4
star
24

collectd-framework

CollectD Plugin to Apache Kafka
Java
3
star
25

stockpile

stockpile is a mesos executor for go_kafka_client scheduler that mirros data from Apache Kafka to Apache Cassandra
Go
3
star
26

siesta-producer

Go
2
star
27

go-kafka-client-mesos

Go Kafka Client Mesos Framework
Go
2
star
28

mesos-jira

Simple JIRA on Mesos
1
star
29

go-log-kafka

1
star
30

pyrgus

Go Metrics, Logging and Distributed Tracing library for Apache Kafka
Go
1
star
31

syphon

Go
1
star
32

java-mesos-util

Apache Mesos Java Utility for Framework Support
Java
1
star