You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example demonstrates how to consume records published using KPL aggregation using `KinesisStreamsSource`.
9
+
10
+
This folder contains two separate modules:
11
+
1.[kpl-producer](kpl-producer): a simple command line Java application to produce the JSON record to a Kinesis Stream, using KPL aggregation
12
+
2.[flink-app](flink-app): the Flink application demonstrating how to consume the aggregated stream, and publishing the de-aggregated records to another stream.
13
+
14
+
Look at the instructions in the subfolders to run the KPL Producer (data generator) and the Flink application.
15
+
16
+
### Background and motivation
17
+
18
+
As of version `5.0.0`, `KinesisStreamsSource` does not support de-aggregation yet.
19
+
20
+
If the connector is used to consume a stream produced with KPL aggregation, the source is not able to deserialize the records out of the box.
21
+
22
+
This example shows how to implement de-aggregation in the deserialization schema.
23
+
24
+
In particular, this example uses a wrapper which can be used to add de-aggregation to potentially any implementation
25
+
of `org.apache.flink.api.common.serialization.DeserializationSchema`.
This Flink job consumes a Kinesis stream with aggregated JSON records, and publish them to another stream.
4
+
5
+
### Prerequisites
6
+
7
+
The application expects two Kinesis Streams:
8
+
* Input stream containing the aggregated records
9
+
* Output stream where the de-aggregated records are published
10
+
11
+
The application must have sufficient permissions to read and write the streams.
12
+
13
+
### Runtime configuration
14
+
15
+
The application reads the runtime configuration from the Runtime Properties, when running on Amazon Managed Service for Apache Flink,
16
+
or, when running locally, from the [`resources/flink-application-properties-dev.json`](resources/flink-application-properties-dev.json) file located in the resources folder.
|`InputStream0`|`stream.arn`| ARN of the input stream. |
23
+
|`InputStream0`|`aws.region`| Region of the input stream. |
24
+
|`InputStream0`|`source.init.position`| (optional) Starting position when the application starts with no state. Default is `LATEST`|
25
+
|`InputStream0`|`source.reader.type`| (optional) Choose between standard (`POLLING`) and Enhanced Fan-Out (`EFO`) consumer. Default is `POLLING`. |
26
+
|`InputStream0`|`source.efo.consumer.name`| (optional, for EFO consumer mode only) Name of the EFO consumer. Only used if `source.reader.type=EFO`. |
27
+
|`InputStream0`|`source.efo.consumer.lifecycle`| (optional, for EFO consumer mode only) Lifecycle management mode of EFO consumer. Choose between `JOB_MANAGED` and `SELF_MANAGED`. Default is `JOB_MANAGED`. |
28
+
|`OutputStream0`|`stream.arn`| ARN of the output stream. |
29
+
|`OutputStream0`|`aws.region`| Region of the output stream. |
30
+
31
+
Every parameter in the `InputStream0` group is passed to the Kinesis consumer, and every parameter in the `OutputStream0` is passed to the Kinesis client of the sink.
32
+
33
+
See Flink Kinesis connector docs](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/connectors/datastream/kinesis/) for details about configuring the Kinesis connector.
34
+
35
+
To configure the application on Managed Service for Apache Flink, set up these parameter in the *Runtime properties*.
36
+
37
+
To configure the application for running locally, edit the [json file](resources/flink-application-properties-dev.json).
38
+
39
+
### Running in IntelliJ
40
+
41
+
You can run this example directly in IntelliJ, without any local Flink cluster or local Flink installation.
42
+
43
+
See [Running examples locally](../../running-examples-locally.md) for details.
44
+
45
+
46
+
### Data Generator
47
+
48
+
Use the [KPL Producer](../kpl-producer) to generate aggregates StockPrices to the Kinesis stream
// Name of the local JSON resource with the application properties in the same format as they are received from the Amazon Managed Service for Apache Flink runtime
0 commit comments