async microservices communication
event-driven
REST oriented
reliability
responsibility
all events are transported via Nakadi
tooling and analysis on top
secured RESTful API
underlying infrastructure is proven and well-known
event type registry
compatibility with STUPS
event
event type - similar to topic in MQ, channel for communication
producer - one who is publishing an event to an event type
consumer - one who is listening on an event type and gets notified when an event occurs
offset - point from which to start consuming events
partition - not needed at the moment!
As consumers we want to be notified when an event occurs (in real-time).
Low-level API
High-level API
A consumer sends an HTTP request on a specific event type
Nakadi does not respond...
...but instead sends an event as it occurs
HTTP connection "never" closes
A consumer subscribes to a specific event type...
...providing a callback API
An event occurs and is POSTed on the callback API
Low-Level API - implemented (and later demoed)
Subscription API - under construction
Event filtering - yet to come
Prerequisites
Create a new event type
Connect to consume an event on newly created type
Produce an event on newly created type
Offset in practice
Nakadi inspector
Backend libraries
Your favorite HTTP crawler (curl, http, postman, etc.)
curl -v -X POST https://nakadi-staging.aruha-test.zalan.do/event-types \
--header "Authorization: Bearer your-zign-token-here" \
--header "Content-Type:application/json" \
-d '{
"name": "brand-solutions.test",
"owning_application": "bs.test",
"category": "undefined",
"partition_strategy": "random",
"schema": {
"type": "json_schema",
"schema": "{ \"additionalProperties\": true }"
}
}'
curl -v -X GET https://nakadi-staging.aruha-test.zalan.do/event-types/brand-solutions.test \
--header "Authorization: Bearer your-zign-token-here" \
--header "Content-Type:application/json"
curl -v -X GET https://nakadi-staging.aruha-test.zalan.do/event-types/brand-solutions.test/events \
--header "Authorization: Bearer your-zign-token-here" \
--header "Content-Type:application/json" \
--header 'X-Nakadi-Cursors:[{"partition": "0", "offset":"BEGIN"}]'
curl -v -X POST https://nakadi-staging.aruha-test.zalan.do/event-types/brand-solutions.test/events \
--header "Authorization: Bearer your-zign-token-here" \
--header "Content-Type:application/json" \
-d '[{"foo": "bar"}]'
curl -v -X GET https://nakadi-staging.aruha-test.zalan.do/event-types/brand-solutions.test/events \
--header "Authorization: Bearer your-zign-token-here" \
--header "Content-Type:application/json" \
--header 'X-Nakadi-Cursors:[{"partition": "0", "offset":"10"}]'
Nikita did 5-minute-prototype-jQuery project
Inner-source: Nakadi inspector
DEMO