dybyte commented on code in PR #10335:
URL: https://github.com/apache/seatunnel/pull/10335#discussion_r2778931598
##########
docs/en/connectors/sink/Kafka.md:
##########
@@ -90,6 +91,23 @@ If not set partition key fields, the null message key will
be sent to.
The format of the message key is json, If name is set as the key, for example
'{"name":"Jack"}'.
The selected field must be an existing field in the upstream.
+### Kafka Headers Fields
+
+For example, if you want to use value of fields from upstream data as kafka
message headers, you can assign field names to this property.
+
+Upstream data is the following:
+
+| name | age | data | source | traceId |
+|------|-----|---------------|--------|-----------|
+| Jack | 16 | data-example1 | web | trace-123 |
+| Mary | 23 | data-example2 | mobile | trace-456 |
+
+If source and traceId are set as the kafka headers fields, then these field
values will be added as headers to the kafka message.
+For example, the first row will have headers: `source=web` and
`traceId=trace-123`.
+The field values will be converted to strings and used as header values.
+If a field value is null, it will not be added to the headers.
Review Comment:
This part of the documentation should be deleted to reflect the changes in
how null values are now handled in headers.
##########
docs/en/connectors/sink/Kafka.md:
##########
@@ -90,6 +91,23 @@ If not set partition key fields, the null message key will
be sent to.
The format of the message key is json, If name is set as the key, for example
'{"name":"Jack"}'.
The selected field must be an existing field in the upstream.
+### Kafka Headers Fields
+
+For example, if you want to use value of fields from upstream data as kafka
message headers, you can assign field names to this property.
+
+Upstream data is the following:
+
+| name | age | data | source | traceId |
+|------|-----|---------------|--------|-----------|
+| Jack | 16 | data-example1 | web | trace-123 |
+| Mary | 23 | data-example2 | mobile | trace-456 |
+
+If source and traceId are set as the kafka headers fields, then these field
values will be added as headers to the kafka message.
+For example, the first row will have headers: `source=web` and
`traceId=trace-123`.
Review Comment:
Could you please add a note in the documentation explaining that these
header fields will be excluded from the message value?
##########
docs/zh/connectors/sink/Kafka.md:
##########
@@ -89,6 +90,23 @@ NON 不提供任何保证:如果 Kafka 代理出现问题,消息可能会丢
消息 key 的格式为 json,如果设置 name 为 key,例如 `{"name":"Jack"}`。
所选的字段必须是上游数据中已存在的字段。
+### Kafka Headers 字段
+
+例如,如果你想使用上游数据中的字段值作为 kafka 消息的 headers,可以将这些字段名指定给此属性。
+
+上游数据如下所示:
+
+| name | age | data | source | traceId |
+|------|-----|---------------|--------|-----------|
+| Jack | 16 | data-example1 | web | trace-123 |
+| Mary | 23 | data-example2 | mobile | trace-456 |
+
+如果将 source 和 traceId 设置为 kafka headers 字段,那么这些字段值将作为 headers 添加到 kafka 消息中。
+例如,第一行将具有 headers:`source=web` 和 `traceId=trace-123`。
+字段值将被转换为字符串并用作 header 值。
+如果字段值为 null,则不会添加到 headers 中。
+所选的字段必须是上游数据中已存在的字段。
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]