forked from apache/seatunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Improve][CDC] Optimize options & add docs for compatible_debezium_js…
…on (apache#4351) * Using enum define format options * Rename canal-json to canal_json * Add docs
- Loading branch information
Showing
18 changed files
with
184 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
docs/en/connector-v2/formats/cdc-compatible-debezium-json.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# CDC compatible debezium-json | ||
|
||
Seatunnel supports to interpret cdc record as Debezium-JSON messages publish to mq(kafka) system. | ||
|
||
This is useful in many cases to leverage this feature, such as compatible with the debezium ecosystem. | ||
|
||
# How to use | ||
|
||
## MySQL-CDC output to Kafka | ||
|
||
```bash | ||
env { | ||
execution.parallelism = 1 | ||
job.mode = "STREAMING" | ||
checkpoint.interval = 15000 | ||
} | ||
|
||
source { | ||
MySQL-CDC { | ||
result_table_name = "table1" | ||
|
||
hostname = localhost | ||
base-url="jdbc:mysql://localhost:3306/test" | ||
"startup.mode"=INITIAL | ||
catalog { | ||
factory=MySQL | ||
} | ||
table-names=[ | ||
"database1.t1", | ||
"database1.t2", | ||
"database2.t1" | ||
] | ||
|
||
# compatible_debezium_json options | ||
format = compatible_debezium_json | ||
debezium = { | ||
# include schema into kafka message | ||
key.converter.schemas.enable = false | ||
value.converter.schemas.enable = false | ||
# include ddl | ||
include.schema.changes = true | ||
# topic prefix | ||
database.server.name = "mysql_cdc_1" | ||
} | ||
# compatible_debezium_json fixed schema | ||
schema = { | ||
fields = { | ||
topic = string | ||
key = string | ||
value = string | ||
} | ||
} | ||
} | ||
} | ||
|
||
sink { | ||
Kafka { | ||
source_table_name = "table1" | ||
|
||
bootstrap.servers = "localhost:9092" | ||
|
||
# compatible_debezium_json options | ||
format = compatible_debezium_json | ||
} | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...a/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/config/MessageFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.seatunnel.connectors.seatunnel.kafka.config; | ||
|
||
public enum MessageFormat { | ||
JSON, | ||
TEXT, | ||
CANAL_JSON, | ||
COMPATIBLE_DEBEZIUM_JSON | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.