nzw921rx opened a new issue, #13408:
URL: https://github.com/apache/seatunnel/issues/13408
### Search before asking
I searched existing Kafka Sink and format issues. #9773 and #9805 cover
merging updates for file sinks.
### Description
With `format = "canal_json"`, Kafka Sink publishes an `UPDATE_BEFORE` and
`UPDATE_AFTER` pair as a `DELETE` followed by an `INSERT`. A consumer that
handles Canal `UPDATE` messages receives two separate operations for a single
source update.
Expose `merge_update_event` for Canal JSON in Kafka Sink, following the
opt-in configuration used by the file sinks.
```hocon
Kafka {
format = "canal_json"
merge_update_event = true
}
```
- Default to `false` so existing jobs keep their current key, payload, and
routing behavior.
- With `true`, emit one Kafka record for a matching update pair. Set `type`
to `UPDATE`, put the new row in `data`, and include the before values in `old`.
Buffer the before row without sending a Kafka tombstone.
- Use the existing `UPDATE_AFTER` topic and key for a merged record. Fall
back to `DELETE` and `INSERT` when the topic or the values of
`partition_key_fields` change across the pair, so both routes receive the
applicable change. Compare the configured key field values for this case. The
serialized Canal JSON key also contains the operation type.
- Keep standalone `INSERT` and `DELETE` behavior. Define how unmatched
update rows are handled across checkpoints and restore.
- Extend `KafkaFormatIT` to check the record count, payload, and key with
the option disabled and enabled. Document the option and the shape of `old` in
the English and Chinese Kafka Sink guides.
### Usage Scenario
A MySQL-CDC job writes to Kafka for an existing consumer that processes each
update as one Canal `UPDATE` record.
### Related issues
- #9773
- #9805
--
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]