A distributed event bus that implements a RESTful API abstraction on top of Kafka-like queues
Switch branches/tags
testPlugin subscription-004 subscription-003 subscription-002 subscription-001 release/R2016_03_30_17_08 release/R16_00_10 r20170426rc1 r2017_08_10-aruha-1026-v2 r2017_08_10-aruha-1026-v1 r2.8.7-2018-09-04 r2.8.6-2018-08-27 r2.8.5-2018-08-22 r2.8.5-2018-08-09 r2.8.4-2018-08-02 r2.8.3-2018-08-01 r2.8.2-2018-07-31 r2.8.1-2018-07-23 r2.8.0-2018-07-16 r2.7.8-2018-07-02 r2.7.7-2018-06-26 r2.7.6-2018-06-21 r2.7.5-2018-06-20 r2.7.4-2018-06-13 r2.7.3-2018-06-11 r2.7.3-2018-06-07 r2.7.2-2018-05-30 r2.7.1-2018-05-28 r2.7.0-2018-05-25 r2.6.7-2018-05-15 r2.6.6-2018-05-08 r2.6.5-2018-05-03 r2.6.4-2018-04-26 r2.6.3-2018-04-12 r2.6.3-2018-04-10 r2.6.2-2018-04-05 r2.6.1-2018-04-03 r2.6.0-2018-03-26 r2.5.9-2018-03-06 r2.5.8-2017-02-22 r2.5.7-2018-02-15 r2.5.6-2018-02-07 r2.5.5-2018-01-24 r2.5.4-2018-01-18 r2.5.3-2018-01-15 r2.5.2-2018-01-08 r2.5.1-2018-01-03 r2.5.0-2017-12-27 r2.4.2-2017-12-21 r2.4.1-2017-12-19 r2.3.5-2017-12-15 r2.3.4-2017-12-14 r2.3.3-2017-12-12 r2.3.2-2017-12-05 r2.3.1-2017-11-29 r2.3.0-2017-11-16 r2.2.9-2017-11-14 r2.2.9-2017-11-02 r2.2.8-2017-11-01 r2.2.7-2017-10-25 r2.2.6-2017-10-17 r2.2.4-2017-10-13 r2.2.3-2017-10-13 r2.2.2-2017-09-28 r2.2.1-2017-09-26 r2.2.0-2017-08-29 r2.1.1-2017-08-22 r2.1.0-2017-08-21 r2.0.1-2017-08-11 r2.0.0-2017-08-09 r2.0.0-1-2017-08-10 r.1.1.3-2017-08-03 r1.1.1-2017-08-01 r1.1.1-2017-07-26 r1.1.0-2017-07-25 r1.0.1-2017-07-14 r1.0.0-2017-07-12 cursor-ops-rc6 cursor-ops-rc4 cursor-ops-rc3 cursor-ops-rc2 cursor-ops-rc1 aruha1083v3 aruha1083v2 aruha1083v1 aruha1015v9-jetty-500-threads aruha1015v8-jetty-no-lz4 aruha1015v7-base-branch-with-lz4 aruha1015v6-jetty aruha1015v5-jetty aruha1015v4 aruha1015v3 aruha1015v2 aruha1015v1 aruha870-v4 aruha870-v3 aruha870-v2 aruha870-v1 aruha870-rc1 aruha860rc1
Nothing to show
Clone or download
adyach Merge pull request #952 from cbornet/fix-startup
Put nakadi-event-bus-api.yaml under the api/ folder in docker
Latest commit b6f40df Sep 21, 2018

README.md

Nakadi Event Broker

Build Status codecov.io Codacy Badge

Nakadi is a distributed event bus broker that implements a RESTful API abstraction on top of Kafka-like queues, which can be used to send, receive, and analyze streaming data in real time, reliable and highly available manner.

One of the most prominent use case of Nakadi is to enable decoupling of micro-services by building data streams between producers and consumers.

Main users of nakadi are developers and analysts. Nakadi provides features like REST based integration, multi consumer, ordered delivery, interactive UI, fully managed, security, ensuring data quality, abstraction of big data technology, and push model based consumption.

Nakadi is in active developement and is currently in production inside Zalando as the backbone of our microservices sending millions of events daily with a throughput of more than hundreds gigabytes per second. In one line Nakadi is a high-scalability data-stream for enterprise engineering teams.

Nakadi Deployment Diagram

More detailed information can be found on our website.

Project goal

The goal of Nakadi (ნაკადი means stream in Georgian) is to provide an event broker infrastructure to:

  • Abstract event delivery via a secured RESTful API.

    This allows microservices teams to maintain service boundaries, and not directly depend on any specific message broker technology. Access can be managed individually for every queue and secured using OAuth and custom authorization plugins.

  • Enable convenient development of event-driven applications and asynchronous microservices.

    Event types can be defined with Event type schemas and managed via a registry. All events will be validated against the schema before publishing. This guarantees data quality and consistency for consumers.

  • Efficient low latency event delivery.

    Once a publisher sends an event using a simple HTTP POST, consumers can be pushed to via a streaming HTTP connection, allowing near real-time event processing. The consumer connection has keepalive controls and support for managing stream offsets using subscriptions.

Development status

  • Nakadi is high-load production ready.
  • Zalando uses Nakadi as its central Event Bus Service.
  • Nakadi reliably handles the traffic from thousands event types with the throughput of more than hundreds gigabytes per second.
  • The project is in active development. See the CHANGELOG.md

Presentations

Features

  • Stream:
    • REST abstraction over Kafka-like queues.
    • CRUD for event types.
    • Event batch publishing.
    • Low-level interface (deprecated).
      • manual client side partition management is needed
      • no support of commits
    • High-level interface (Subscription API).
      • automatic redistribution of partitions between consuming clients
      • commits should be issued to move server-side cursors
  • Schema:
    • Schema registry.
    • Several event type categories (Undefined, Business, Data Change).
    • Several partitioning strategies (Random, Hash, User defined).
    • Event enrichment strategies.
    • Schema evolution.
    • Events validation using an event type schema.
  • Security:
    • OAuth2 authentication.
    • Per-event type authorization.
    • Blacklist of users and applications.
  • Operations:
    • STUPS platform compatible.
    • ZMON monitoring compatible.
    • SLO monitoring.
    • Timelines.
      • This allows transparently switch production and consumption to different cluster (tier, region, AZ) without moving actual data and any service degradation.
      • Opens possibility for implementation of other streaming technologies and engines besides Kafka (like AWS Kinesis, Google pub/sub etc.)

Read more about latest development in our CHANGELOG.md

Additional features that we plan to cover in the future are:

  • Support for different streaming technologies and engines. Nakadi currently uses Apache Kafka as its broker, but other providers (such as Kinesis) will be possible.
  • Filtering of events for subscribing consumers.
  • Store old published events forever using transparent fall back backup shortages like AWS S3.
  • Separate the internal schema register to standalone service.
  • Use additional schema formats and protocols like Avro, protobuf and others.

Related projects

The zalando-nakadi organisation contains many useful related projects like

How to contribute to Nakadi

Read our contribution guidelines on how to submit issues and pull requests, then get Nakadi up and running locally using Docker:

Dependencies

The Nakadi server is a Java 8 Spring Boot application. It uses Kafka 1.1.1 as its broker and PostgreSQL 9.5 as its supporting database.

Nakadi requires recent versions of docker and docker-compose. In particular, docker-compose >= v1.7.0 is required. See Install Docker Compose for information on installing the most recent docker-compose version.

The project is built with Gradle. The ./gradlew wrapper script will bootstrap the right Gradle version if it's not already installed.

Mac OS specific configuration

Install

To get the source, clone the git repository.

git clone https://github.com/zalando/nakadi.git

Building

The gradle setup is fairly standard, the main tasks are:

  • ./gradlew build: run a build and test
  • ./gradlew clean: clean down the build

Some other useful tasks are:

  • ./gradlew acceptanceTest: run the ATs
  • ./gradlew fullAcceptanceTest: run the ATs in the context of Docker
  • ./gradlew startNakadi: build Nakadi and start docker-compose services: nakadi, postgresql, zookeeper and kafka
  • ./gradlew stopNakadi: shutdown docker-compose services
  • ./gradlew startStorages: start docker-compose services: postgres, zookeeper and kafka (useful for development purposes)
  • ./gradlew stopStorages: shutdown docker-compose services

For working with an IDE, the eclipse IDE task is available and you'll be able to import the build.gradle into Intellij IDEA directly.

Running a Server

From the project's home directory you can start Nakadi via Gradle:

./gradlew startNakadi

This will build the project and run docker compose with 4 services:

  • Nakadi (8080)
  • PostgreSQL (5432)
  • Kafka (9092)
  • Zookeeper (2181)

To stop the running Nakadi server:

./gradlew stopNakadi

Using Nakadi and its API

Please read the manual for the full API usage details.

Creating Event Types

The Nakadi API allows the publishing and consuming of events over HTTP. To do this the producer must register an event type with the Nakadi schema registry.

This example shows minimal undefined category event type with a wilcard schema -

curl -v -XPOST http://localhost:8080/event-types -H "Content-type: application/json" -d '{
  "name": "order.ORDER_RECEIVED",
  "owning_application": "order-service",
  "category": "undefined", 
  "schema": {
    "type": "json_schema",
    "schema": "{ \"additionalProperties\": true }"
  }
}'

Note: This is not recommended category and schema. It should be used only for the testing.

Read mode in the manual

Consuming Events

You can open a stream for an Event Type via the events sub-resource:

curl -v http://localhost:8080/event-types/order.ORDER_RECEIVED/events 
    

HTTP/1.1 200 OK

{"cursor":{"partition":"0","offset":"82376-000087231"},"events":[{"order_number": "ORDER_001"}]}
{"cursor":{"partition":"0","offset":"82376-000087232"}}
{"cursor":{"partition":"0","offset":"82376-000087232"},"events":[{"order_number": "ORDER_002"}]}
{"cursor":{"partition":"0","offset":"82376-000087233"},"events":[{"order_number": "ORDER_003"}]}

You will see the events when you publish them from another console for example. The records without events field are Keep Alive messages.

Note: This is the low-level API should be used only for debugging. It is not recommended for production systems. For production systems please use Subscriptions API

Publishing Events

Events for an event type can be published by posting to its "events" collection:

curl -v -XPOST http://localhost:8080/event-types/order.ORDER_RECEIVED/events \
 -H "Content-type: application/json" \
 -d '[{
    "order_number": "24873243241"
  }, {
    "order_number": "24873243242"
  }]'


HTTP/1.1 200 OK  

Read more in the manual

Contributing

Nakadi accepts contributions from the open-source community.

Please read CONTRIBUTING.md.

Please also note our CODE_OF_CONDUCT.md.

Contact

This email address serves as the main contact address for this project.

Bug reports and feature requests are more likely to be addressed if posted as issues here on GitHub.

License

Please read the full LICENSE

The MIT License (MIT) Copyright © 2015 Zalando SE, https://tech.zalando.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.