|
4 | 4 | :project-owner: redis-field-engineering
|
5 | 5 | :project-name: redis-flink-connector
|
6 | 6 | :project-group: com.redis
|
7 |
| -:project-version: 0.0.1 |
| 7 | +:project-version: 0.0.2 |
8 | 8 | :dist-repo-name: redis-flink-connector-dist
|
9 | 9 |
|
10 | 10 | The Redis Flink Connector is a highly performant, scalable Flink Source and Sink
|
@@ -34,7 +34,7 @@ Add the following to your `build.gradle` file
|
34 | 34 | .build.gradle
|
35 | 35 | ----
|
36 | 36 | dependencies {
|
37 |
| - implementation '{project-group}:{project-name}:{project-version}' |
| 37 | + implementation '{project-group}:{project-name}-spring:{project-version}' |
38 | 38 | }
|
39 | 39 | ----
|
40 | 40 |
|
@@ -113,6 +113,34 @@ String sourceName = "Redis to Redis";
|
113 | 113 | env.fromSource(sourceBuilder.build(), WatermarkStrategy.noWatermarks(), sourceName, typeInfo).sinkTo(sinkBuilder.build());
|
114 | 114 | ----
|
115 | 115 |
|
| 116 | +== Serializers and Keys |
| 117 | + |
| 118 | +The Redis Flink Connector's natural data type is the `RedisMessage` class. This class contains the data of the message (a `Map<String,String>`) and the key for the Message (a `String`). |
| 119 | +The `RedisPasssthroughSerializer` and the `RedisMessageDeserializer` are a simple serializer/deserializer pair that allows you to work directly with the `RedisMessage` object. |
| 120 | + |
| 121 | +The `RedisObjectSerializer` and `RedisObjectDeserializer` are generic serializers/deserializers that allow you to work with your standard serializable POJOs. |
| 122 | +You can use these if you want to work with your own objects domain objects, the object is serialized to JSON and added as the |
| 123 | +`data` field of the Stream Message that is sent to Redis. |
| 124 | + |
| 125 | +If you use these, you may also want to provide a `RedisKeyExtractor` to extract the key from the object, otherwise, a hashcode extracted from the JSON payload of the object will act as the key. |
| 126 | + |
| 127 | +The key determines what partition that a message will be sent to. |
| 128 | + |
| 129 | +=== Configure Serializer and Key Extractor |
| 130 | + |
| 131 | +You can configure the serializer and key extractor in the `RedisSinkBuilder`: |
| 132 | + |
| 133 | +[source,java] |
| 134 | +---- |
| 135 | +RedisSinkBuilder<Person> sinkBuilder = new RedisSinkBuilder<Person>(new RedisObjectSerializer<>(), sinkConfig).keyExtractor(Person::getName); |
| 136 | +---- |
| 137 | + |
| 138 | +And you can configure which deserializer to use in the `RedisSourceBuilder`: |
| 139 | +[source,java] |
| 140 | +---- |
| 141 | +RedisSourceBuilder<Person> sourceBuilder = new RedisSourceBuilder<>(sourceConfig, new RedisObjectDeserializer<>(Person.class)); |
| 142 | +---- |
| 143 | + |
116 | 144 | == Quick Start
|
117 | 145 |
|
118 | 146 | You can run the demo in this repo by running:
|
|
0 commit comments