|
| 1 | +:name: Stream Source Connector |
| 2 | +[[_source_stream]] |
| 3 | += {name} |
| 4 | + |
| 5 | +The {name} reads from a Redis stream and publishes messages to a Kafka topic. |
| 6 | + |
| 7 | +[[_source_stream_class]] |
| 8 | +== Class Name |
| 9 | + |
| 10 | +The {name} class name is `com.redis.kafka.connect.RedisStreamSourceConnector`. |
| 11 | + |
| 12 | +The corresponding configuration property would be: |
| 13 | + |
| 14 | +[source,properties] |
| 15 | +---- |
| 16 | +connector.class = com.redis.kafka.connect.RedisStreamSourceConnector |
| 17 | +---- |
| 18 | + |
| 19 | +[[_source_stream_delivery]] |
| 20 | +== Delivery Guarantees |
| 21 | + |
| 22 | +The {name} can be configured to ack stream messages either automatically (at-most-once delivery) or explicitly (at-least-once delivery). |
| 23 | +The default is at-least-once delivery. |
| 24 | + |
| 25 | +=== At-Least-Once |
| 26 | + |
| 27 | +In this mode, each stream message is acknowledged after it has been written to the corresponding topic. |
| 28 | + |
| 29 | +[source,properties] |
| 30 | +---- |
| 31 | +redis.stream.delivery = at-least-once |
| 32 | +---- |
| 33 | + |
| 34 | +=== At-Most-Once |
| 35 | + |
| 36 | +In this mode, stream messages are acknowledged as soon as they are read. |
| 37 | + |
| 38 | +[source,properties] |
| 39 | +---- |
| 40 | +redis.stream.delivery = at-most-once |
| 41 | +---- |
| 42 | + |
| 43 | +[[_source_stream_tasks]] |
| 44 | +== Tasks |
| 45 | + |
| 46 | +Reading from the stream is done through a consumer group so that multiple instances of the connector configured via the `tasks.max` can consume messages in a round-robin fashion. |
| 47 | + |
| 48 | +[[_source_stream_redis_client]] |
| 49 | +include::{includedir}/_redis_client.adoc[leveloffset=+1] |
| 50 | + |
| 51 | +[[_source_stream_schema]] |
| 52 | +== Message Schema |
| 53 | + |
| 54 | +=== Key Schema |
| 55 | + |
| 56 | +Keys are of type String and contain the stream message id. |
| 57 | + |
| 58 | +=== Value Schema |
| 59 | + |
| 60 | +The value schema defines the following fields: |
| 61 | + |
| 62 | +[options="header"] |
| 63 | +|==== |
| 64 | +|Name|Schema|Description |
| 65 | +|id |STRING |Stream message ID |
| 66 | +|stream|STRING |Stream key |
| 67 | +|body |Map of STRING|Stream message body |
| 68 | +|==== |
| 69 | + |
| 70 | +[[_source_stream_config]] |
| 71 | +=== Configuration |
| 72 | + |
| 73 | +[source,properties] |
| 74 | +---- |
| 75 | +connector.class = com.redis.kafka.connect.RedisStreamSourceConnector |
| 76 | +redis.stream.name = <name> <1> |
| 77 | +redis.stream.offset = <offset> <2> |
| 78 | +redis.stream.block = <millis> <3> |
| 79 | +redis.stream.consumer.group = <group> <4> |
| 80 | +redis.stream.consumer.name = <name> <5> |
| 81 | +redis.stream.delivery = <mode> <6> |
| 82 | +topic = <name> <7> |
| 83 | +---- |
| 84 | + |
| 85 | +<1> Name of the stream to read from. |
| 86 | +<2> {link_stream_msg_id} to start reading from (default: `0-0`). |
| 87 | +<3> Maximum {link_xread} wait duration in milliseconds (default: `100`). |
| 88 | +<4> Name of the stream consumer group (default: `kafka-consumer-group`). |
| 89 | +<5> Name of the stream consumer (default: `consumer-${task}`). |
| 90 | +May contain `${task}` as a placeholder for the task id. |
| 91 | +For example, `foo${task}` and task `123` => consumer `foo123`. |
| 92 | +<6> Delivery mode: `at-least-once`, `at-most-once` (default: `at-least-once`). |
| 93 | +<7> Destination topic (default: `${stream}`). |
| 94 | +May contain `${stream}` as a placeholder for the originating stream name. |
| 95 | +For example, `redis_${stream}` and stream `orders` => topic `redis_orders`. |
| 96 | + |
0 commit comments