| 1 | # Data Plane Kafka extension |
| 2 | |
| 3 | ## Background |
| 4 | |
| 5 | ### Scope |
| 6 | |
| 7 | This extension provides support for consuming from and publishing to a Kafka broker. |
| 8 | |
| 9 | ### Limitations |
| 10 | |
| 11 | > ⚠️ **This code is not intended for production-grade streaming pipelines!** |
| 12 | |
| 13 | Even if it provides capabilities to stream events from an event source to a destination, this implementation drops |
| 14 | most of the inherent guarantees and benefits of a streaming pipeline, i.e. asynchronicity, ordering, resilience, delivery guarantee... |
| 15 | Depending on the protocol chosen to push the events to the consumer (e.g. http), it might also come with poor performances. |
| 16 | |
| 17 | It also puts the pressure on the provider Data Plane which must operate the consuming threads (see `KafkaDataSource`) that |
| 18 | are constantly polling for events on the source topic. One thread being created for each transfer, it means that the number of threads |
| 19 | allocated by the provider Data Plane for fetching the events will linearly increase with the number of consumers, which might become |
| 20 | a limiting factor at some point. |
| 21 | |
| 22 | Finally, the sink (see `HttpDataSink`) is publishing events asynchronously and in parallel, which means that there is no guarantee |
| 23 | on the final order in which events are delivered. |
| 24 | |
| 25 | ### Use Cases |
| 26 | |
| 27 | Streaming events from the provider Kafka broker and pushing them to the consumer (potentially with a different protocol, such as http, websocket...). |
| 28 | |
| 29 | ## Technical Details |
| 30 | |
| 31 | ### `KafkaDataSource` |
| 32 | |
| 33 | #### Data Address |
| 34 | |
| 35 | This `DataSource` implementation is triggered when the type of the source address is set to `Kafka` (case-insensitive). |
| 36 | Parameters are listed below: |
| 37 | |
| 38 | | Parameter | Description | Mandatory | Default value | |
| 39 | |:-------------|:---------------------------------------------------------------------------------------|:--------------------------------------------|:------------------------------------| |
| 40 | | topic | Broker topic from which events are consumed | true | | |
| 41 | | kafka.* | Kafka consumer properties | Only `kafka.bootstrap.servers` is mandatory | | |
| 42 | | name | Name of the transfer | false | `null` | |
| 43 | | maxDuration | Duration of the stream, specified as ISO-8601 duration e.g. "PT10S" for 10 seconds | false | If not specified, stream never ends | |
| 44 | | pollDuration | Duration between two polls, specified as ISO-8601 duration e.g. "PT10S" for 10 seconds | false | 1 second | |
| 45 | |
| 46 | #### Consumer group |
| 47 | |
| 48 | The consumer group is automatically determined from the request as followed: |
| 49 | |
| 50 | ``` |
| 51 | <CONSUMER_GROUP>=<PROCESS_ID>:<REQUEST_ID> |
| 52 | ``` |
| 53 | |
| 54 | ### `KafkaDataSink` |
| 55 | |
| 56 | #### Data address |
| 57 | |
| 58 | This `DataSink` implementation is triggered when the type of the source address is set to `Kafka` (case-insensitive). |
| 59 | Parameters are listed below: |
| 60 | |
| 61 | | Parameter | Description | Mandatory | Default value | |
| 62 | |:----------|:--------------------------------------------|:--------------------------------------------|:--------------| |
| 63 | | topic | Broker topic from which events are consumed | true | | |
| 64 | | kafka.* | Kafka producer properties | Only `kafka.bootstrap.servers` is mandatory | | |
| 65 | |
| 66 | #### Event publishing |
| 67 | |
| 68 | Events are published in parallel and asynchronously (non-blocking). There is no retry-on-error nor guarantee on the order |
| 69 | in which events are published. |