forked from zalando/nakadi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nakadi-event-bus-api.yaml
1321 lines (1173 loc) · 48.6 KB
/
nakadi-event-bus-api.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
swagger: '2.0'
info:
title: Nakadi Event Bus API Definition
description: |
-----------
Definitions
-----------
Nakadi at its core aims at being a generic and content-agnostic event broker with a convenient API.
In doing this, Nakadi abstracts away, as much as possible, details of the backing messaging
infrastructure. The single currently supported messaging infrastructure is Kafka (Kinesis is planned
for the future).
In Nakadi every Event has an EventType, and a **stream** of Events is exposed for each registered
EventType.
An EventType defines properties relevant for the operation of its associated stream, namely:
* The **schema** of the Event of this EventType. The schema defines the accepted format of Events of an
EventType and will be, if so desired, enforced by Nakadi. Usually Nakadi will respect the schema for
the EventTypes in accordance to how an owning Application defines them.
**Note:** *Currently the specification of the schema must be pushed into Nakadi on EventType creation;
in the future, assuming that Applications will expose the schema for its owned resources, Nakadi might
support fetching the schema directly from them.*
* The expected **validation** and **enrichment** procedures upon reception of an Event.
Validation define conditions for the acceptance of the incoming Event and are strictly enforced by
Nakadi. Usually the validation will enforce compliance of the payload (or part of it) with the defined
schema of its EventType. Enrichment specify properties that are added to the payload (body) of the Event
before persisting it. Usually enrichment affects the metadata of an Event but is not limited to.
* The **ordering** expectations of Events in this stream. Each EventType will have its Events stored in
an underlying logical stream (the Topic) that is physically organized in disjoint collections of
strictly ordered Events (the Partition). The EventType defines the field that acts as evaluator of the
ordering (that is, its partition key); this ordering is guaranteed by making Events whose partition
key resolves to the same Partition (usually a hash function on its value) be persisted strictly ordered
in a Partition.
In practice this means that all Events within a Partition have their relative order guaranteed: Events
(of a same EventType) that are *about* a same data entity (that is, have the same value on its Partition
key) reach always the same Partition, the relative ordering of them is secured. This mechanism implies
that no statements can be made about the relative ordering of Events that are in different partitions.
Except for defined enrichment rules, Nakadi will never manipulate the content of any Event.
Clients of Nakadi can be grouped in 2 categories: **EventType owners** and **Clients** (clients in turn
are both **Producers** and **Consumers** of Events). Event Type owners interact with Nakadi via the
**Schema Registry API** for the definition of EventTypes, while Clients via the streaming API for
submission and reception of Events.
A low level **Unmanaged API** is available, providing full control and responsibility of position
tracking and partition resolution (and therefore ordering) to the Clients.
In the high level **Subscription API** the consumption of Events proceeds via the establishment of a
named **Subscription** to an EventType. Subscriptions are persistent relationships from an Application
(which might have several instances) and the stream of one or more EventType's, whose consumption
tracking is managed by Nakadi, freeing Consumers from any responsibility in tracking of the current
position on a Stream.
**Note** *Currently the high level API is out of scope in this specification.
It is in the short term plan to be included.*
Scope and status of this document
---------------------------------
The present API specification is in **draft** state and is subject to change.
In this document, ready for review are included:
* The Schema Registry API, including configuration possibilities for the Schema, Validation, Enrichment
and Partitioning of Events, and their effects on reception of Events.
* The stantardised event format (see definition of Event, BusinessEvent and DataChangeEvent) (Note: at a
later moment this will be configurable and not be inherent part of this API).
* Unmanaged API (low level).
Other aspects of the Event Bus are at this moment to be defined and otherwise specified, not included
in this version of this specification.
Notable omissions here are:
* The contract between Nakadi and clients in the context of the high-level API (i.e. the process for
clients to establish subscriptions).
* Enrichment procedure.
* Security scopes (OAuth) for the different operations
* Explicit control of (in case of Kafka as underlying messaging broker) topic's creation
parameters (number of partitions, retention times, etc), as well as their modification.
version: '0.5.1'
contact:
name: Team Aruha @ Zalando
email: [email protected]
schemes:
- https
consumes:
- application/json
produces:
- application/json
securityDefinitions:
oauth2:
type: oauth2
flow: implicit
authorizationUrl: 'https://auth.example.com/oauth2/tokeninfo'
scopes:
nakadi.config.write: |
Grants access for changing Nakadi configuration.
nakadi.event_type.write: |
Grants access for applications to define and update EventTypes.
nakadi.event_stream.write: |
Grants access for applications to submit Events.
nakadi.event_stream.read: |
Grants access for consuming Event streams.
paths:
/metrics:
get:
tags:
- monitoring
summary: Get monitoring metrics
responses:
'200':
description: Ok
schema:
$ref: '#/definitions/Metrics'
'401':
description: Client is not authenticated
schema:
$ref: '#/definitions/Problem'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
/event-types:
get:
tags:
- schema-registry-api
description: Returns a list of all registered `EventType`s
parameters:
- name: X-Flow-Id
in: header
description: |
The flow id of the request, which is written into the logs and passed to called services. Helpful
for operational troubleshooting and log analysis.
type: string
format: flow-id
responses:
'200':
description: Ok
schema:
type: array
items:
$ref: '#/definitions/EventType'
'401':
description: Client is not authenticated
schema:
$ref: '#/definitions/Problem'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
post:
tags:
- schema-registry-api
security:
- oauth2: ['nakadi.event_type.write']
description: |
Creates a new `EventType`.
**Implementation note:** The creation of an EventType implicitly creates the structures in the
backing messaging implementation needed for the reception and persistence of the Events. Considering
that at this time only Kafka is used, this corresponds to the creation of a Topic. If so desired,
clients can interact directly with the topic using the low level API (for existing restrictions see
the corresponding methods on the topic-api).
The fields validation-strategies, enrichment-strategies and partition-resolution-strategy have all an
effect on the incoming Event of this EventType. For its impacts on the reception of events please
consult the Event submission API methods.
* Validation strategies define an array of validation stategies to be evaluated on reception of
an `Event` of this `EventType`. Details of usage can be found in an external document (TBD link to
document).
* TBD Enrichment strategy
* The schema of an `EventType` is defined as an `EventTypeSchema`. Currently only json-schema is
supported.
Following conditions are enforced. Not meeting them will fail the request with the indicated status
(details are provided in the Problem object):
* EventType name on creation must be unique (or attempting to update an `EventType` with this
method), otherwise the request is rejected with status 409 Conflict.
* Using `EventTypeSchema.type` other than json-schema or passing a `EventTypeSchema.schema`
that is invalid with respect to the schema's type. Rejects with 422 Unprocessable entity.
* Referring any of Validation, Enrichment or Partition strategies that does not exist or whose
parametrization is deemed invalid. Rejects with 422 Unprocessable entity.
Nakadi MIGHT impose necessary schema, validation and enrichment minimal configurations that MUST be
followed by all EventTypes (examples include: validation rules to match the schema; enriching every
Event with the reception date-type; adhering to a set of schema fields that are mandatory for all
EventTypes). **The mechanism to set and inspect such rules is not defined at this time and might not
be exposed in the API.**
parameters:
- name: event-type
in: body
description: EventType to be created
schema:
$ref: '#/definitions/EventType'
required: true
responses:
'201':
description: Created
'401':
description: Client is not authenticated
schema:
$ref: '#/definitions/Problem'
'409':
description: Conflict, for example on creation of EventType with already existing name.
schema:
$ref: '#/definitions/Problem'
'422':
description: Unprocessable Entity
schema:
$ref: '#/definitions/Problem'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
/event-types/{name}:
get:
tags:
- schema-registry-api
description: |
Returns the `EventType` identified by its name.
parameters:
- name: name
in: path
description: Name of the EventType to load.
type: string
required: true
- name: X-Flow-Id
in: header
description: |
The flow id of the request, which is written into the logs and passed to called services. Helpful
for operational troubleshooting and log analysis.
type: string
format: flow-id
responses:
'200':
description: Ok
schema:
$ref: '#/definitions/EventType'
'401':
description: Client is not authenticated
schema:
$ref: '#/definitions/Problem'
'404':
description: EventType not found
schema:
$ref: '#/definitions/Problem'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
put:
tags:
- schema-registry-api
security:
- oauth2: ['nakadi.event_type.write']
description: |
Updates the `EventType` identified by its name. Behaviour is the same as creation of `EventType` (See
POST /event-type) except where noted below.
The name field cannot be changed. Attempting to do so will result in a 422 failure.
At this moment changes in the schema are not supported and will produce a 422 failure. (TODO: define
conditions for backwards compatible extensions in the schema)
parameters:
- name: name
in: path
description: Name of the EventType to update.
type: string
required: true
- name: event-type
in: body
description: EventType to be updated.
schema:
$ref: '#/definitions/EventType'
required: true
- name: X-Flow-Id
in: header
description: |
The flow id of the request, which is written into the logs and passed to called services. Helpful
for operational troubleshooting and log analysis.
type: string
format: flow-id
responses:
'200':
description: Ok
'401':
description: Client is not authenticated
schema:
$ref: '#/definitions/Problem'
'404':
description: EventType not found.
schema:
$ref: '#/definitions/Problem'
'422':
description: Unprocessable Entity
schema:
$ref: '#/definitions/Problem'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
delete:
tags:
- schema-registry-api
security:
- oauth2: ['nakadi.config.write']
description: |
Deletes an `EventType` identified by its name. The underlying Kafka topic and all events of this
`EventType` will also be removed.
**Note**: Kafka's topic deletion happens asynchronously with respect to this DELETE call; therefore
creation of an equally named `EventType` before the underlying topic deletion is complete will not
succeed (failure is a 409 Conflic).
parameters:
- name: name
in: path
description: Name of the EventType to delete.
type: string
required: true
- name: X-Flow-Id
in: header
description: |
The flow id of the request, which is written into the logs and passed to called services. Helpful
for operational troubleshooting and log analysis.
type: string
format: flow-id
responses:
'200':
description: EventType is successfuly removed
'401':
description: Client is not authenticated
schema:
$ref: '#/definitions/Problem'
'403':
description: Client is not authorized to perform this operation
schema:
$ref: '#/definitions/Problem'
'404':
description: EventType not found.
schema:
$ref: '#/definitions/Problem'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
/event-types/{name}/events:
post:
tags:
- stream-api
security:
- oauth2: ['nakadi.event_stream.write']
description: |
Publishes a batch of `Event`s of this `EventType`. All items must be of the EventType identified
by `name`.
Reception of Events will always respect the configuration of its `EventType` with respect to
validation, enrichment and partition. The steps performed on reception of incoming message are:
1. Every validation rule specified in the `EventType` will be checked in order against the incoming
Events. Validation rules are evaluated in the order they are defined and the Event is **rejected**
in the first case of failure. If the offending validation rule
provides information about the violation it will be included in the `BatchItemResponse`.
If the `EventType` defines schema validation it will be performed at this moment.
1. Once the validation succeeded, the content of the Event is updated according to the enrichment
rules in the order the rules are defined in the `EventType`.
No preexisting value might be changed (even if added by an enrichment rule). Violations on this will
force the immediate **rejection** of the Event. The invalid overwrite
attempt will be included in the item's `BatchItemResponse` object.
1. The incoming Event's relative ordering is evaluated according to the rule on the
`EventType`. Failure to evaluate the rule will **reject** the Event.
Given the batched nature of this operation, any violation on validation or failures on enrichment or
partitioning will cause the whole batch to be rejected, i.e. none of its elements are pushed to the
underlying broker.
Failures on writing of specific partitions to the broker might influence other partitions. Failures
at this stage will fail only the affected partitions.
parameters:
- name: name
in: path
type: string
description: Name of the EventType
required: true
- name: X-Flow-Id
in: header
description: |
The flow id of the request, which is written into the logs and passed to called services. Helpful
for operational troubleshooting and log analysis.
type: string
format: flow-id
- name: event
in: body
description: The Event being published
schema:
type: array
items:
$ref: '#/definitions/Event'
required: true
responses:
'200':
description: All events in the batch have been successfully published.
'207':
description: At least one event has failed to be submitted. The batch might be partially submitted.
schema:
type: array
items:
$ref: '#/definitions/BatchItemResponse'
'400':
description: Bad request
schema:
$ref: '#/definitions/Problem'
'401':
description: Client is not authenticated
schema:
$ref: '#/definitions/Problem'
'404':
description: EventType not found.
schema:
$ref: '#/definitions/Problem'
'405':
description: Not allowed.
schema:
$ref: '#/definitions/Problem'
'422':
description: At least one event failed to be validated, enriched or partitioned. None were submitted.
schema:
type: array
items:
$ref: '#/definitions/BatchItemResponse'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
get:
tags:
- stream-api
- unmanaged-api
security:
- oauth2: ['nakadi.event_stream.read']
description: |
Starts a stream delivery for the specified partitions of the given EventType.
The event stream is formatted as a sequence of `EventStreamBatch`es separated by `\n`. Each
`EventStreamBatch` contains a chunk of Events and a `Cursor` pointing to the **end** of the
chunk (i.e. last delivered Event). The cursor might specify the offset with the symbolic value
`BEGIN`, which will open the stream starting from the oldest available offset in the partition.
Currently this format is the only one supported by the system, but in the future other MIME types
will be supported (like `application/event-stream`).
If streaming for several distinct partitions, each one is an independent `EventStreamBatch`.
The initialization of a stream can be parameterized in terms of size of each chunk, timeout for
flushing each chunk, total amount of delivered Events and total time for the duration of the stream.
Nakadi will keep a streaming connection open even if there are no events to be delivered. In this
case the timeout for the flushing of each chunk will still apply and the `EventStreamBatch` will
contain only the Cursor pointing to the same offset. This can be treated as a keep-alive control for
some load balancers.
The tracking of the current offset in the partitions and of which partitions is being read is in
the responsibility of the client. No commits are needed.
produces:
- application/x-json-stream
parameters:
- name: name
in: path
description: EventType name to get events about
type: string
required: true
- name: X-nakadi-cursors
in: header
description: |
Cursors indicating the partitions to read from and respective starting offsets.
Assumes the offset on each cursor is not inclusive (i.e., first delivered Event is the
**first one after** the one pointed to in the cursor).
If the header is not present, the stream for all partitions defined for the EventType will start
from the newest event available in the system at the moment of making this call.
**Note:** we are not using query parameters for passing the cursors only because of the length
limitations on the HTTP query. Another way to initiate this call would be the POST method with
cursors passed in the method body. This approach can implemented in the future versions of this
API.
required: false
type: string
format: serialized json array of '#/definitions/Cursor'
- name: batch_limit
in: query
description: |
Maximum number of `Event`s in each chunk (and therefore per partition) of the stream.
* If 0 or unspecified will buffer Events indefinitely and flush on reaching of
`batch_flush_timeout`.
type: integer
format: int32
required: false
default: 1
- name: stream_limit
in: query
description: |
Maximum number of `Event`s in this stream (over all partitions being streamed in this
connection).
* If 0 or undefined, will stream batches indefinitely.
* Stream initialization will fail if `stream_limit` is lower than `batch_limit`.
type: integer
format: int32
required: false
default: 0
- name: batch_flush_timeout
in: query
description: |
Maximum time in seconds to wait for the flushing of each chunk (per partition).
* If the amount of buffered Events reaches `batch_limit` before this `batch_flush_timeout`
is reached, the messages are immediately flushed to the client and batch flush timer is reset.
* If 0 or undefined, will assume 30 seconds.
type: number
format: int32
required: false
default: 30
- name: stream_timeout
in: query
description: |
Maximum time in seconds a stream will live before being interrupted.
If 0 or unspecified will stream indefinitely.
If this timeout is reached, any pending messages (in the sense of `stream_limit`) will be flushed
to the client.
Stream initialization will fail if `stream_timeout` is lower than `batch_flush_timeout`.
type: number
format: int32
required: false
default: 0
- name: stream_keep_alive_limit
in: query
description: |
Maximum number of keep-alive messages to get in a row before closing the connection.
If 0 or undefined will send keep alive messages indefinitely.
type: integer
format: int32
required: false
default: 0
- name: X-Flow-Id
in: header
description: |
The flow id of the request, which is written into the logs and passed to called services. Helpful
for operational troubleshooting and log analysis.
type: string
format: flow-id
responses:
'200':
description: |
Starts streaming to the client.
Stream format is a continuous series of `EventStreamBatch`s separated by `\n`
schema:
$ref: '#/definitions/EventStreamBatch'
'400':
description: Bad syntax
schema:
$ref: '#/definitions/Problem'
'401':
description: Not authenticated
schema:
$ref: '#/definitions/Problem'
'404':
description: EventType not found
schema:
$ref: '#/definitions/Problem'
'422':
description: Unprocessable entity
schema:
$ref: '#/definitions/Problem'
'500':
description: Internal Server Error. Details are provided on the returned `Problem`.
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
'/event-types/{name}/partitions':
get:
tags:
- unmanaged-api
- monitoring
- management-api
security:
- oauth2: ['nakadi.event_stream.read']
description: |
Lists the `Partition`s for the given event-type.
This endpoint is mostly interesting for monitoring purposes or in cases when consumer wants to start
consuming older messages.
parameters:
- name: name
in: path
description: EventType name
type: string
required: true
- name: X-Flow-Id
in: header
description: |
The flow id of the request, which is written into the logs and passed to called services. Helpful
for operational troubleshooting and log analysis.
type: string
format: flow-id
responses:
'200':
description: OK
schema:
type: array
description: An array of `Partition`s
items:
$ref: '#/definitions/Partition'
'404':
description: EventType not found
schema:
$ref: '#/definitions/Problem'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
/event-types/{name}/partitions/{partition}:
get:
tags:
- unmanaged-api
- management-api
security:
- oauth2: ['nakadi.event_stream.read']
description: Returns the given `Partition` of this EventType
parameters:
- name: name
in: path
description: EventType name
type: string
required: true
- name: partition
in: path
description: Partition id
type: string
required: true
- name: X-Flow-Id
in: header
description: |
The flow id of the request, which is written into the logs and passed to called services. Helpful
for operational troubleshooting and log analysis.
type: string
format: flow-id
responses:
'200':
description: OK
schema:
$ref: '#/definitions/Partition'
'401':
description: Client is not authenticated
schema:
$ref: '#/definitions/Problem'
'404':
description: Not found
schema:
$ref: '#/definitions/Problem'
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
'/registry/validation-strategies':
get:
tags:
- schema-registry-api
description: |
Lists all of the validation strategies supported by this installation of Nakadi.
If the EventType creation is to have special validations (besides the default), one can consult over
this method the available possibilities.
responses:
'200':
description: Returns a list of all validation strategies known to Nakadi
schema:
type: array
items:
type: string
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
'/registry/enrichment-strategies':
get:
tags:
- schema-registry-api
description: |
Lists all of the enrichment strategies supported by this installation of Nakadi.
If the EventType creation is to have special enrichments (besides the default), one can consult over
this method the available possibilities.
responses:
'200':
description: Returns a list of all enrichment strategies known to Nakadi
schema:
type: array
items:
type: string
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
'503':
description: Service (temporarily) unavailable
schema:
$ref: '#/definitions/Problem'
'/registry/partition-strategies':
get:
tags:
- schema-registry-api
description: |
Lists all of the partition resolution strategies supported by this installation of Nakadi.
If the EventType creation is to have a specific partition strategy (other than the default), one can
consult over this method the available possibilities.
Nakadi offers currently, out of the box, the following strategies:
- `random`: Resolution of the target partition happens randomly (events are evenly distributed on the
topic's partitions).
- `user_defined`: Target partition is defined by the client. As long as the indicated partition
exists, Event assignment will respect this value. Correctness of the relative ordering of events is
under the responsibility of the Producer.
Requires that the client provides the target partition on `metadata.partition` (See
`EventMetadata`). Failure to do so will reject the publishing of the Event.
- `hash`: Resolution of the partition follows the computation of a hash from the value of the fields
indicated in the EventType's `partition_key_fields`, guaranteeing that Events with same values
on those fields end in the same partition.
responses:
'200':
description: Returns a list of all partitioning strategies known to Nakadi
schema:
type: array
items:
type: string
'500':
description: Server error
schema:
$ref: '#/definitions/Problem'
# ################################### #
# #
# Definitions #
# #
# ################################### #
definitions:
Event:
type: object
description: |
**Note** The Event definition will be externalized in future versions of this document.
A basic payload of an Event. The actual schema is dependent on the information configured for the
EventType, as is its enforcement (see POST /event-types). Setting of metadata properties are
dependent on the configured enrichment as well.
For explanation on default configurations of validation and enrichment, see documentation of
`EventType.category`.
For concrete examples of what will be enforced by Nakadi see the objects BusinessEvent and
DataChangeEvent below.
additionalProperties: true
EventMetadata:
type: object
description: |
Metadata for this Event.
Contains commons fields for both Business and DataChange Events. Most are enriched by Nakadi upon
reception, but they in general MIGHT be set by the client.
properties:
metadata:
type: object
properties:
eid:
description: |
Identifier of this Event.
Clients MUST generate this value and it SHOULD be guaranteed to be unique from the
perspective of the producer. Consumers MIGHT use this value to assert uniqueness of reception
of the Event.
type: string
format: uuid
example: '105a76d8-db49-4144-ace7-e683e8f4ba46'
event_type:
description: |
The EventType of this Event. This is enriched by Nakadi on reception of the Event based on the
endpoint where the Producer sent the Event to.
If provided MUST match the endpoint. Failure to do so will cause rejection of the Event.
type: string
example: 'pennybags.payment-business-event'
occurred_at:
description: |
Timestamp of creation of the Event generated by the producer.
type: string
format: date-time
example: '1996-12-19T16:39:57-08:00'
received_at:
type: string
description: |
Timestamp of the reception of the Event by Nakadi. This is enriched upon reception of the
Event.
If set by the producer Event will be rejected.
format: date-time
example: '1996-12-19T16:39:57-08:00'
parent_eids:
type: array
items:
type: string
format: uuid
description: |
Event identifier of the Event that caused the generation of this Event.
Set by the producer.
example: '105a76d8-db49-4144-ace7-e683e8f4ba46'
flow_id:
description: |
The flow-id of the producer of this Event. As this is usually a HTTP header, this is enriched
from the header into the metadata by Nakadi to avoid clients having to explicitly copy this.
type: string
example: 'JAh6xH4OQhCJ9PutIV_RYw'
partition:
description: |
Indicates the partition assigned to this Event.
Required to be set by the client if partition strategy of the EventType is 'user_defined'.
type: string
example: '0'
required:
- eid
- occurred_at
additionalProperties: false
required:
- metadata
BusinessEvent:
type: object
description: |
A Business Event.
Usually represents a status transition in a Business process.
allOf:
- $ref: '#/definitions/EventMetadata'
additionalProperties: true
DataChangeEventQualifier:
type: object
description: |
Indicators of a `DataChangeEvent`'s referred data type and the type of operations done on them.
properties:
data_type:
type: string
example: 'pennybags:order'
data_op:
type: string
enum: ['C', 'U', 'D', 'S']
description: |
The type of operation executed on the entity.
* C: Creation
* U: Update
* D: Deletion
* S: Snapshot
required:
- data_type
- data_op
DataChangeEvent:
type: object
description: |
A Data change Event.
Represents a change on a resource.
allOf:
- $ref: '#/definitions/DataChangeEventQualifier'
- $ref: '#/definitions/EventMetadata'
properties:
data:
type: object
description: |
The payload of the type
required:
- data
additionalProperties: false
Problem:
type: object
properties:
type:
type: string
format: uri
description: |
An absolute URI that identifies the problem type. When dereferenced, it SHOULD provide
human-readable API documentation for the problem type (e.g., using HTML).
This Problem object is the same as provided by https://github.com/zalando/problem
example: http://httpstatus.es/503
title:
type: string
description: |
A short, summary of the problem type. Written in English and readable for engineers (usually not
suited for non technical stakeholders and not localized)
example: Service Unavailable
status:
type: integer
format: int32
description: |
The HTTP status code generated by the origin server for this occurrence of the problem.
example: 503