This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new cdb97ae98 Fix #3373: new debezium-mysql-source and
debezium-sqlserver-source Kamelets, the changes of MySQL and SQL Server tables
as they happen (#3381)
cdb97ae98 is described below
commit cdb97ae984b8a0855d2f8ff6f58dddaac9009014
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 23 22:06:46 2026 +0100
Fix #3373: new debezium-mysql-source and debezium-sqlserver-source
Kamelets, the changes of MySQL and SQL Server tables as they happen (#3381)
* Fix #3373: new debezium-mysql-source and debezium-sqlserver-source
Kamelets, the changes of MySQL and SQL Server tables as they happen
Both Preview, on the design of debezium-postgresql-source: one JSON message
per row
change with the debezium-operation, debezium-table and debezium-key
headers; the
position and the schema history in files or in Kafka topics. Citrus tests in
DatabaseIT#debezium for MySQL (file and Kafka stores) and SQL Server (CDC).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* Fix #3373: the Debezium sources fail to start when the engine cannot
start (CAMEL-27448), and Camel JBang adds the MySQL driver (CAMEL-27447)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* chore: regenerate the catalog files after merging main
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* ci: write the output of each Camel integration to .citrus-jbang, which CI
uploads when a run fails
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../camel-kamelets-catalog-sbom.json | 46 ++-
docs/modules/ROOT/nav.adoc | 2 +
kamelets/debezium-mysql-source.kamelet.yaml | 270 +++++++++++++++++
kamelets/debezium-postgresql-source.kamelet.yaml | 2 +-
kamelets/debezium-sqlserver-source.kamelet.yaml | 276 ++++++++++++++++++
.../main/resources/META-INF/kamelets-index.json | 22 +-
.../kamelets/debezium-mysql-source.kamelet.yaml | 270 +++++++++++++++++
.../debezium-postgresql-source.kamelet.yaml | 2 +-
.../debezium-sqlserver-source.kamelet.yaml | 276 ++++++++++++++++++
.../test/resources/citrus-application.properties | 17 ++
.../database/debezium/debezium-mysql-init.sql | 5 +
...ebezium-mysql-source-kafka-route.citrus.it.yaml | 159 ++++++++++
.../debezium-mysql-source-kafka-route.yaml | 44 +++
.../debezium-mysql-source-route.citrus.it.yaml | 300 +++++++++++++++++++
.../debezium/debezium-mysql-source-route.yaml | 57 ++++
.../debezium-sqlserver-source-route.citrus.it.yaml | 320 +++++++++++++++++++++
.../debezium/debezium-sqlserver-source-route.yaml | 56 ++++
17 files changed, 2120 insertions(+), 4 deletions(-)
diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index baa42d883..a12b41b09 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -346,11 +346,21 @@
"type" : "library",
"name" : "databricks-source",
"version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:debezium-mysql-source",
+ "type" : "library",
+ "name" : "debezium-mysql-source",
+ "version" : "4.24.0-SNAPSHOT"
}, {
"bom-ref" : "kamelet:debezium-postgresql-source",
"type" : "library",
"name" : "debezium-postgresql-source",
"version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:debezium-sqlserver-source",
+ "type" : "library",
+ "name" : "debezium-sqlserver-source",
+ "version" : "4.24.0-SNAPSHOT"
}, {
"bom-ref" : "kamelet:delay-action",
"type" : "library",
@@ -1635,6 +1645,17 @@
"name" : "camel.apache.org/versioned-by",
"value" : "runtime"
} ]
+ }, {
+ "bom-ref" :
"pkg:maven/org.apache.camel/[email protected]",
+ "type" : "library",
+ "group" : "org.apache.camel",
+ "name" : "camel-debezium-mysql",
+ "version" : "4.24.0-SNAPSHOT",
+ "purl" : "pkg:maven/org.apache.camel/[email protected]",
+ "properties" : [ {
+ "name" : "camel.apache.org/versioned-by",
+ "value" : "runtime"
+ } ]
}, {
"bom-ref" :
"pkg:maven/org.apache.camel/[email protected]",
"type" : "library",
@@ -1646,6 +1667,17 @@
"name" : "camel.apache.org/versioned-by",
"value" : "runtime"
} ]
+ }, {
+ "bom-ref" :
"pkg:maven/org.apache.camel/[email protected]",
+ "type" : "library",
+ "group" : "org.apache.camel",
+ "name" : "camel-debezium-sqlserver",
+ "version" : "4.24.0-SNAPSHOT",
+ "purl" :
"pkg:maven/org.apache.camel/[email protected]",
+ "properties" : [ {
+ "name" : "camel.apache.org/versioned-by",
+ "value" : "runtime"
+ } ]
}, {
"bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
"type" : "library",
@@ -2568,7 +2600,7 @@
} ],
"dependencies" : [ {
"ref" : "camel-kamelets-catalog",
- "dependsOn" : [ "kamelet:ai-tool-source",
"kamelet:avro-deserialize-action", "kamelet:avro-serialize-action",
"kamelet:aws-bedrock-agent-runtime-sink", "kamelet:aws-bedrock-agent-sink",
"kamelet:aws-bedrock-text-sink", "kamelet:aws-cloudtrail-source",
"kamelet:aws-cloudwatch-sink", "kamelet:aws-comprehend-sink",
"kamelet:aws-ddb-sink", "kamelet:aws-ddb-streams-source",
"kamelet:aws-ec2-sink", "kamelet:aws-eventbridge-sink",
"kamelet:aws-eventbridge-source", "kamelet:aws-kinesis-fireh [...]
+ "dependsOn" : [ "kamelet:ai-tool-source",
"kamelet:avro-deserialize-action", "kamelet:avro-serialize-action",
"kamelet:aws-bedrock-agent-runtime-sink", "kamelet:aws-bedrock-agent-sink",
"kamelet:aws-bedrock-text-sink", "kamelet:aws-cloudtrail-source",
"kamelet:aws-cloudwatch-sink", "kamelet:aws-comprehend-sink",
"kamelet:aws-ddb-sink", "kamelet:aws-ddb-streams-source",
"kamelet:aws-ec2-sink", "kamelet:aws-eventbridge-sink",
"kamelet:aws-eventbridge-source", "kamelet:aws-kinesis-fireh [...]
}, {
"ref" : "kamelet:ai-tool-source",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -2770,9 +2802,15 @@
}, {
"ref" : "kamelet:databricks-source",
"dependsOn" : [ "pkg:maven/com.databricks/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.commons/[email protected]" ]
+ }, {
+ "ref" : "kamelet:debezium-mysql-source",
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:debezium-postgresql-source",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ }, {
+ "ref" : "kamelet:debezium-sqlserver-source",
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:delay-action",
"dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]"
]
@@ -3415,9 +3453,15 @@
}, {
"ref" : "pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
+ }, {
+ "ref" : "pkg:maven/org.apache.camel/[email protected]",
+ "dependsOn" : [ ]
}, {
"ref" :
"pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
+ }, {
+ "ref" :
"pkg:maven/org.apache.camel/[email protected]",
+ "dependsOn" : [ ]
}, {
"ref" : "pkg:maven/org.apache.camel/[email protected]",
"dependsOn" : [ ]
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 1e971611d..abbde4a24 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -66,7 +66,9 @@
* xref:data-type-action.adoc[]
* xref:databricks-sink.adoc[]
* xref:databricks-source.adoc[]
+* xref:debezium-mysql-source.adoc[]
* xref:debezium-postgresql-source.adoc[]
+* xref:debezium-sqlserver-source.adoc[]
* xref:delay-action.adoc[]
* xref:dns-dig-action.adoc[]
* xref:dns-ip-action.adoc[]
diff --git a/kamelets/debezium-mysql-source.kamelet.yaml
b/kamelets/debezium-mysql-source.kamelet.yaml
new file mode 100644
index 000000000..39d3751d1
--- /dev/null
+++ b/kamelets/debezium-mysql-source.kamelet.yaml
@@ -0,0 +1,270 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: debezium-mysql-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmVyc2lvbj0iMS4wIj4KIDxyZWN0IGZpbGw9IiMyNjU1N2MiIHdpZHRoPSIyOCIgaGVpZ2h0PSIyOCIgeD0iLTMwIiB5PSItMzAiIHJ4PSIxLjQiIHJ5PSIxLjQiIHRyYW5zZm9ybT0ibWF0cml4KDAsLTEsLTEsMCwwLDApIi8+CiA8cGF0aCBvcGFjaXR5PSIuMiIgZD0ibTguMDI1NCA4LjAwMDFjLTAuNzgyNS0wLjAxNjYtMS4xNDk0IDAuNTI0NC0wLjk4ODMgMS40NTcgMC4wNTIgMC4zMDA2IDAuMzE1MiAwLjcyOTkgMC44ODI4IDEuNDQxOSAwLjYzMTIyID
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Debezium"
+ camel.apache.org/kamelet.namespace: "Database"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "Debezium MySQL Source"
+ description: |-
+ Sends a message for each row inserted, updated or deleted in the tables
of a MySQL database, as it happens (change data capture with Debezium).
+
+ Use it to pass the changes of a database on to another system as they
happen, for example to keep a search index or a cache up to date, or to copy
new orders to a queue, without polling the tables. To read rows with a query
again and again, use `mysql-source`.
+
+ Output: the body is JSON text in bytes, an object with the column names
as keys, such as `{"id":1,"name":"Tea","price":4.50}`: the row after the
change, and for a delete the row before it. The columns are in the order of the
table. A `DECIMAL` column is a JSON number with its decimals, such as `4.50`,
and a `DATE` column the number of days since 1970-01-01, such as `20454` for
2026-01-01. The `debezium-operation` header says what happened: `c` (insert),
`u` (update), `d` (delete) o [...]
+
+ Good to know: the server must write its binary log (binlog) in the `ROW`
format with the whole row (`binlog_format=ROW` and `binlog_row_image=FULL`, the
defaults of MySQL 8), and the user needs the `SELECT`, `RELOAD`, `SHOW
DATABASES`, `REPLICATION SLAVE` and `REPLICATION CLIENT` privileges. The
Kamelet reads the binlog as a replica of the server does, under the id
`serverId`. On the first start, it by default sends every row of the tables
first (`snapshotMode`). It saves how far i [...]
+ required:
+ - serverName
+ - username
+ - password
+ - serverId
+ - topicPrefix
+ type: object
+ properties:
+ serverName:
+ title: Server Name
+ description: The host name or IP address of the MySQL server, without
the port.
+ type: string
+ example: db.example.com
+ serverPort:
+ title: Server Port
+ description: The port the MySQL server listens on. MySQL uses 3306
unless it was set up otherwise.
+ type: integer
+ default: 3306
+ username:
+ title: Username
+ description: The database user to log in as. It needs the `SELECT`,
`RELOAD`, `SHOW DATABASES`, `REPLICATION SLAVE` and `REPLICATION CLIENT`
privileges.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: Password
+ description: The password of the database user `username`.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ serverId:
+ title: Server Id
+ description: The number the Kamelet uses as a replica of the MySQL
server to read the binlog, such as `5400`. It must differ from the `server_id`
of every MySQL server and of every other client that reads the binlog of the
same servers, the other Kamelets included.
+ type: integer
+ example: 5400
+ topicPrefix:
+ title: Logical Name
+ description: A name for this source of changes, made of letters,
digits, `.`, `_` and `-`. The saved position is stored under this name, so keep
it the same across restarts, and give each Kamelet that reads another server
its own name.
+ type: string
+ pattern: "^[a-zA-Z0-9._-]+$"
+ example: shop
+ tableIncludeList:
+ title: Tables
+ description: The tables whose changes to send, as regular expressions
that match `database.table`, separated by commas, such as
`shop.orders,shop.customers`. When it is not set, the changes of all tables of
all databases are sent, except those of the system databases.
+ type: string
+ example: shop.orders,shop.customers
+ snapshotMode:
+ title: Snapshot Mode
+ description: "Whether to send the rows that are already in the tables
before the changes. `initial` (the default): on the first start, every row of
the tables is sent with the operation `r`, then the changes; after a restart
with a saved position, only the changes since. `no_data`: only the changes made
from the first start on. `always`: every row on each start, then the changes.
`initial_only`: every row on the first start, and no changes. `when_needed`: as
`initial`, and every [...]
+ type: string
+ enum: ["initial", "no_data", "always", "initial_only", "when_needed",
"recovery"]
+ default: initial
+ sslMode:
+ title: TLS Mode
+ description: "Whether the connection to MySQL uses TLS. `preferred`
(the default): TLS when the server offers it, without checking its certificate.
`required`: always TLS, without checking the certificate of the server.
`disabled`: no TLS."
+ type: string
+ enum: ["disabled", "preferred", "required"]
+ default: preferred
+ offsetStorageFileName:
+ title: Position File
+ description: The file where the Kamelet saves how far it got, such as
`/data/offsets.dat`, read again after a restart. It is created when it does not
exist, but its folder must exist and be writable, or the Kamelet fails to
start. A relative name is in the folder the integration runs in. When it is
lost, the changes are sent again as on the first start. Not used when
`offsetStorage` is the Kafka store.
+ type: string
+ default: debezium-mysql-offsets.dat
+ example: /data/offsets.dat
+ offsetStorage:
+ title: Position Store
+ description: "Where the Kamelet saves how far it got.
`org.apache.kafka.connect.storage.FileOffsetBackingStore` (the default): in the
file `offsetStorageFileName`.
`org.apache.kafka.connect.storage.KafkaOffsetBackingStore`: in the Kafka topic
`offsetStorageTopic`, on the Kafka of `offsetStorageBootstrapServers`, for an
integration that has no lasting disk. Use the same kind of store for
`schemaHistory`."
+ type: string
+ enum: ["org.apache.kafka.connect.storage.FileOffsetBackingStore",
"org.apache.kafka.connect.storage.KafkaOffsetBackingStore"]
+ default: org.apache.kafka.connect.storage.FileOffsetBackingStore
+ offsetStorageBootstrapServers:
+ title: Kafka Brokers
+ description: The Kafka brokers of the Kafka stores of `offsetStorage`
and `schemaHistory`, as `host:port` separated by commas. Needed with a Kafka
store. The connection is made without TLS and without a login.
+ type: string
+ example: my-cluster-kafka-bootstrap:9092
+ offsetStorageTopic:
+ title: Position Topic
+ description: The Kafka topic where the Kafka store saves how far the
Kamelet got. It is created when it does not exist. Needed with the Kafka store.
+ type: string
+ example: shop-offsets
+ offsetStoragePartitions:
+ title: Position Topic Partitions
+ description: The number of partitions of the topic
`offsetStorageTopic` when the Kamelet creates it. Needed with the Kafka store.
+ type: integer
+ example: 1
+ offsetStorageReplicationFactor:
+ title: Position Topic Replicas
+ description: The number of copies of the topic `offsetStorageTopic` on
the Kafka brokers when the Kamelet creates it. Needed with the Kafka store.
+ type: integer
+ example: 3
+ schemaHistoryFileName:
+ title: Schema History File
+ description: The file where the Kamelet keeps the structure of the
tables, such as `/data/schema-history.dat`, read again after a restart. It is
created when it does not exist, with its folders. A relative name is in the
folder the integration runs in. Not used when `schemaHistory` is the Kafka
store.
+ type: string
+ default: debezium-mysql-schema-history.dat
+ example: /data/schema-history.dat
+ schemaHistory:
+ title: Schema History Store
+ description: "Where the Kamelet keeps the structure of the tables.
`io.debezium.storage.file.history.FileSchemaHistory` (the default): in the file
`schemaHistoryFileName`.
`io.debezium.storage.kafka.history.KafkaSchemaHistory`: in the Kafka topic
`schemaHistoryTopic`, on the Kafka of `offsetStorageBootstrapServers`, for an
integration that has no lasting disk."
+ type: string
+ enum: ["io.debezium.storage.file.history.FileSchemaHistory",
"io.debezium.storage.kafka.history.KafkaSchemaHistory"]
+ default: io.debezium.storage.file.history.FileSchemaHistory
+ schemaHistoryTopic:
+ title: Schema History Topic
+ description: The Kafka topic where the Kafka store keeps the structure
of the tables. It is created with one partition when it does not exist. Use a
topic of its own, not `offsetStorageTopic`. Needed with the Kafka store.
+ type: string
+ example: shop-schema-history
+ dataTypes:
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The row after the change, or before it for a delete,
as JSON text in bytes."
+ mediaType: application/json
+ headers:
+ debezium-operation:
+ title: Operation
+ description: "What happened to the row: `c` (insert), `u` (update),
`d` (delete) or `r` (read by the snapshot)."
+ type: string
+ debezium-table:
+ title: Table
+ description: The table of the row, as `database.table`, such as
`shop.orders`.
+ type: string
+ debezium-key:
+ title: Key
+ description: The primary key of the row, as JSON text such as
`{"id":1}`.
+ type: string
+ Content-Type:
+ title: Content Type
+ description: Always `application/json`, as the body is JSON text.
+ type: string
+ dependencies:
+ - "camel:jackson3"
+ - "camel:kamelet"
+ - "camel:debezium-mysql"
+ template:
+ from:
+ uri: debezium-mysql
+ parameters:
+ name: "{{topicPrefix}}"
+ databaseHostname: "{{serverName}}"
+ databasePort: "{{serverPort}}"
+ databaseUser: "{{username}}"
+ databasePassword: "RAW({{password}})"
+ databaseServerId: "{{serverId}}"
+ databaseSslMode: "{{sslMode}}"
+ topicPrefix: "{{topicPrefix}}"
+ tableIncludeList: "{{?tableIncludeList}}"
+ snapshotMode: "{{snapshotMode}}"
+ offsetStorage: "{{offsetStorage}}"
+ offsetStorageFileName: "{{offsetStorageFileName}}"
+ offsetStorageTopic: "{{?offsetStorageTopic}}"
+ offsetStoragePartitions: "{{?offsetStoragePartitions}}"
+ offsetStorageReplicationFactor: "{{?offsetStorageReplicationFactor}}"
+ schemaHistoryInternal: "{{schemaHistory}}"
+ schemaHistoryInternalFileFilename: "{{schemaHistoryFileName}}"
+ additionalProperties.bootstrap.servers:
"{{?offsetStorageBootstrapServers}}"
+ additionalProperties.schema.history.internal.kafka.bootstrap.servers:
"{{?offsetStorageBootstrapServers}}"
+ additionalProperties.schema.history.internal.kafka.topic:
"{{?schemaHistoryTopic}}"
+ steps:
+ # only the changes of rows: not the tombstones, heartbeats or schema
changes, which have no row
+ - filter:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation} in 'c,u,d,r'"
+ steps:
+ - setHeader:
+ name: debezium-operation
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation}"
+ - setHeader:
+ name: debezium-table
+ expression:
+ simple:
+ expression:
"${header.CamelDebeziumSourceMetadata[db]}.${header.CamelDebeziumSourceMetadata[table]}"
+ # the key as JSON text
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header.CamelDebeziumKey} != null"
+ steps:
+ - setProperty:
+ name: debezium-row
+ expression:
+ simple:
+ expression: "${body}"
+ - setBody:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumKey}"
+ - convertBodyTo:
+ type: java.util.Map
+ - marshal:
+ json: {}
+ - setHeader:
+ name: debezium-key
+ expression:
+ simple:
+ expression: "${bodyAs(String)}"
+ - setBody:
+ expression:
+ simple:
+ expression: "${exchangeProperty.debezium-row}"
+ - removeProperty:
+ name: debezium-row
+ # a delete has no row after it: send the row before it
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation} == 'd'"
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumBefore}"
+ - convertBodyTo:
+ type: java.util.Map
+ - marshal:
+ json: {}
+ # the Kafka Connect objects of the component, which other
systems cannot read
+ - removeHeaders:
+ pattern: CamelDebezium*
+ - to:
+ uri: kamelet:sink
diff --git a/kamelets/debezium-postgresql-source.kamelet.yaml
b/kamelets/debezium-postgresql-source.kamelet.yaml
index 2f7425610..31d8a851f 100644
--- a/kamelets/debezium-postgresql-source.kamelet.yaml
+++ b/kamelets/debezium-postgresql-source.kamelet.yaml
@@ -38,7 +38,7 @@ spec:
Output: the body is JSON text in bytes, an object with the column names
as keys, such as `{"id":1,"name":"Tea","price":4.50}`: the row after the
change, and for a delete the row before it. The columns are in the order of the
table. A `NUMERIC` column is a JSON number with its decimals, such as `4.50`,
and a `DATE` column the number of days since 1970-01-01, such as `20454` for
2026-01-01. The `debezium-operation` header says what happened: `c` (insert),
`u` (update), `d` (delete) o [...]
- Good to know: the server must run with `wal_level=logical`, and the user
needs the `REPLICATION` attribute and the right to read the tables. On the
first start, the Kamelet creates a replication slot named `slotName` and a
publication named `publicationName` in the database, and by default sends every
row of the tables first (`snapshotMode`). It saves how far it got in the file
`offsetStorageFileName`, or in a Kafka topic, when it stops and once a minute
while it runs, and after a [...]
+ Good to know: the server must run with `wal_level=logical`, and the user
needs the `REPLICATION` attribute and the right to read the tables. When the
server is not set up as needed, such as with `wal_level=replica`, the Kamelet
fails to start, and the error says why. On the first start, the Kamelet creates
a replication slot named `slotName` and a publication named `publicationName`
in the database, and by default sends every row of the tables first
(`snapshotMode`). It saves how f [...]
required:
- serverName
- username
diff --git a/kamelets/debezium-sqlserver-source.kamelet.yaml
b/kamelets/debezium-sqlserver-source.kamelet.yaml
new file mode 100644
index 000000000..cd731fdb7
--- /dev/null
+++ b/kamelets/debezium-sqlserver-source.kamelet.yaml
@@ -0,0 +1,276 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: debezium-sqlserver-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Debezium"
+ camel.apache.org/kamelet.namespace: "Database"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "Debezium SQL Server Source"
+ description: |-
+ Sends a message for each row inserted, updated or deleted in the tables
of a SQL Server database, as it happens (change data capture with Debezium).
+
+ Use it to pass the changes of a database on to another system as they
happen, for example to keep a search index or a cache up to date, or to copy
new orders to a queue, without polling the tables. To read rows with a query
again and again, use `sqlserver-source`.
+
+ Output: the body is JSON text in bytes, an object with the column names
as keys, such as `{"id":1,"name":"Tea","price":4.50}`: the row after the
change, and for a delete the row before it. The columns are in the order of the
table. A `DECIMAL` column is a JSON number with its decimals, such as `4.50`,
and a `DATE` column the number of days since 1970-01-01, such as `20454` for
2026-01-01. The `debezium-operation` header says what happened: `c` (insert),
`u` (update), `d` (delete) o [...]
+
+ Good to know: the Kamelet reads the changes that the change data capture
(CDC) of SQL Server records, so CDC must be enabled on the database, with `EXEC
sys.sp_cdc_enable_db`, and on each table, such as with `EXEC
sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = 'orders',
@role_name = NULL`, which needs a member of `sysadmin`. SQL Server Agent must
run, as its jobs copy the changes into the change tables of CDC. The changes of
a table without CDC are not sent. The use [...]
+ required:
+ - serverName
+ - username
+ - password
+ - databaseName
+ - topicPrefix
+ type: object
+ properties:
+ serverName:
+ title: Server Name
+ description: The host name or IP address of the SQL Server server,
without the port.
+ type: string
+ example: db.example.com
+ serverPort:
+ title: Server Port
+ description: The port the SQL Server server listens on. SQL Server
uses 1433 unless it was set up otherwise.
+ type: integer
+ default: 1433
+ username:
+ title: Username
+ description: The database user to log in as. It needs to read the
tables and the change tables of CDC, as a member of the `db_owner` role of the
database does.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: Password
+ description: The password of the database user `username`.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ databaseName:
+ title: Database Name
+ description: The name of the database whose changes to send. CDC must
be enabled on it.
+ type: string
+ example: shop
+ topicPrefix:
+ title: Logical Name
+ description: A name for this source of changes, made of letters,
digits, `.`, `_` and `-`. The saved position is stored under this name, so keep
it the same across restarts, and give each Kamelet that reads another database
its own name.
+ type: string
+ pattern: "^[a-zA-Z0-9._-]+$"
+ example: shop
+ tableIncludeList:
+ title: Tables
+ description: The tables whose changes to send, as regular expressions
that match `schema.table`, separated by commas, such as
`dbo.orders,dbo.customers`. When it is not set, the changes of all tables with
CDC are sent.
+ type: string
+ example: dbo.orders,dbo.customers
+ snapshotMode:
+ title: Snapshot Mode
+ description: "Whether to send the rows that are already in the tables
before the changes. `initial` (the default): on the first start, every row of
the tables is sent with the operation `r`, then the changes; after a restart
with a saved position, only the changes since. `no_data`: only the changes made
from the first start on. `always`: every row on each start, then the changes.
`initial_only`: every row on the first start, and no changes. `when_needed`: as
`initial`, and every [...]
+ type: string
+ enum: ["initial", "no_data", "always", "initial_only", "when_needed",
"recovery"]
+ default: initial
+ encrypt:
+ title: Encrypt Connection
+ description: Whether the connection to SQL Server is encrypted with
TLS. When true, the certificate of the server must be trusted by Java, or
`trustServerCertificate` must be true.
+ type: boolean
+ default: true
+ trustServerCertificate:
+ title: Trust Server Certificate
+ description: 'Whether to accept the certificate of the server without
checking it, as needed for a server with a self-signed certificate. Only for
development and tests: the connection can then be intercepted.'
+ type: boolean
+ default: false
+ offsetStorageFileName:
+ title: Position File
+ description: The file where the Kamelet saves how far it got, such as
`/data/offsets.dat`, read again after a restart. It is created when it does not
exist, but its folder must exist and be writable, or the Kamelet fails to
start. A relative name is in the folder the integration runs in. When it is
lost, the changes are sent again as on the first start. Not used when
`offsetStorage` is the Kafka store.
+ type: string
+ default: debezium-sqlserver-offsets.dat
+ example: /data/offsets.dat
+ offsetStorage:
+ title: Position Store
+ description: "Where the Kamelet saves how far it got.
`org.apache.kafka.connect.storage.FileOffsetBackingStore` (the default): in the
file `offsetStorageFileName`.
`org.apache.kafka.connect.storage.KafkaOffsetBackingStore`: in the Kafka topic
`offsetStorageTopic`, on the Kafka of `offsetStorageBootstrapServers`, for an
integration that has no lasting disk. Use the same kind of store for
`schemaHistory`."
+ type: string
+ enum: ["org.apache.kafka.connect.storage.FileOffsetBackingStore",
"org.apache.kafka.connect.storage.KafkaOffsetBackingStore"]
+ default: org.apache.kafka.connect.storage.FileOffsetBackingStore
+ offsetStorageBootstrapServers:
+ title: Kafka Brokers
+ description: The Kafka brokers of the Kafka stores of `offsetStorage`
and `schemaHistory`, as `host:port` separated by commas. Needed with a Kafka
store. The connection is made without TLS and without a login.
+ type: string
+ example: my-cluster-kafka-bootstrap:9092
+ offsetStorageTopic:
+ title: Position Topic
+ description: The Kafka topic where the Kafka store saves how far the
Kamelet got. It is created when it does not exist. Needed with the Kafka store.
+ type: string
+ example: shop-offsets
+ offsetStoragePartitions:
+ title: Position Topic Partitions
+ description: The number of partitions of the topic
`offsetStorageTopic` when the Kamelet creates it. Needed with the Kafka store.
+ type: integer
+ example: 1
+ offsetStorageReplicationFactor:
+ title: Position Topic Replicas
+ description: The number of copies of the topic `offsetStorageTopic` on
the Kafka brokers when the Kamelet creates it. Needed with the Kafka store.
+ type: integer
+ example: 3
+ schemaHistoryFileName:
+ title: Schema History File
+ description: The file where the Kamelet keeps the structure of the
tables, such as `/data/schema-history.dat`, read again after a restart. It is
created when it does not exist, with its folders. A relative name is in the
folder the integration runs in. Not used when `schemaHistory` is the Kafka
store.
+ type: string
+ default: debezium-sqlserver-schema-history.dat
+ example: /data/schema-history.dat
+ schemaHistory:
+ title: Schema History Store
+ description: "Where the Kamelet keeps the structure of the tables.
`io.debezium.storage.file.history.FileSchemaHistory` (the default): in the file
`schemaHistoryFileName`.
`io.debezium.storage.kafka.history.KafkaSchemaHistory`: in the Kafka topic
`schemaHistoryTopic`, on the Kafka of `offsetStorageBootstrapServers`, for an
integration that has no lasting disk."
+ type: string
+ enum: ["io.debezium.storage.file.history.FileSchemaHistory",
"io.debezium.storage.kafka.history.KafkaSchemaHistory"]
+ default: io.debezium.storage.file.history.FileSchemaHistory
+ schemaHistoryTopic:
+ title: Schema History Topic
+ description: The Kafka topic where the Kafka store keeps the structure
of the tables. It is created with one partition when it does not exist. Use a
topic of its own, not `offsetStorageTopic`. Needed with the Kafka store.
+ type: string
+ example: shop-schema-history
+ dataTypes:
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The row after the change, or before it for a delete,
as JSON text in bytes."
+ mediaType: application/json
+ headers:
+ debezium-operation:
+ title: Operation
+ description: "What happened to the row: `c` (insert), `u` (update),
`d` (delete) or `r` (read by the snapshot)."
+ type: string
+ debezium-table:
+ title: Table
+ description: The table of the row, as `schema.table`, such as
`dbo.orders`.
+ type: string
+ debezium-key:
+ title: Key
+ description: The primary key of the row, as JSON text such as
`{"id":1}`.
+ type: string
+ Content-Type:
+ title: Content Type
+ description: Always `application/json`, as the body is JSON text.
+ type: string
+ dependencies:
+ - "camel:jackson3"
+ - "camel:kamelet"
+ - "camel:debezium-sqlserver"
+ template:
+ from:
+ uri: debezium-sqlserver
+ parameters:
+ name: "{{topicPrefix}}"
+ databaseHostname: "{{serverName}}"
+ databasePort: "{{serverPort}}"
+ databaseUser: "{{username}}"
+ databasePassword: "RAW({{password}})"
+ databaseNames: "{{databaseName}}"
+ topicPrefix: "{{topicPrefix}}"
+ tableIncludeList: "{{?tableIncludeList}}"
+ snapshotMode: "{{snapshotMode}}"
+ offsetStorage: "{{offsetStorage}}"
+ offsetStorageFileName: "{{offsetStorageFileName}}"
+ offsetStorageTopic: "{{?offsetStorageTopic}}"
+ offsetStoragePartitions: "{{?offsetStoragePartitions}}"
+ offsetStorageReplicationFactor: "{{?offsetStorageReplicationFactor}}"
+ schemaHistoryInternal: "{{schemaHistory}}"
+ schemaHistoryInternalFileFilename: "{{schemaHistoryFileName}}"
+ # the settings of the JDBC driver of SQL Server
+ additionalProperties.database.encrypt: "{{encrypt}}"
+ additionalProperties.database.trustServerCertificate:
"{{trustServerCertificate}}"
+ additionalProperties.bootstrap.servers:
"{{?offsetStorageBootstrapServers}}"
+ additionalProperties.schema.history.internal.kafka.bootstrap.servers:
"{{?offsetStorageBootstrapServers}}"
+ additionalProperties.schema.history.internal.kafka.topic:
"{{?schemaHistoryTopic}}"
+ steps:
+ # only the changes of rows: not the tombstones, heartbeats or schema
changes, which have no row
+ - filter:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation} in 'c,u,d,r'"
+ steps:
+ - setHeader:
+ name: debezium-operation
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation}"
+ - setHeader:
+ name: debezium-table
+ expression:
+ simple:
+ expression:
"${header.CamelDebeziumSourceMetadata[schema]}.${header.CamelDebeziumSourceMetadata[table]}"
+ # the key as JSON text
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header.CamelDebeziumKey} != null"
+ steps:
+ - setProperty:
+ name: debezium-row
+ expression:
+ simple:
+ expression: "${body}"
+ - setBody:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumKey}"
+ - convertBodyTo:
+ type: java.util.Map
+ - marshal:
+ json: {}
+ - setHeader:
+ name: debezium-key
+ expression:
+ simple:
+ expression: "${bodyAs(String)}"
+ - setBody:
+ expression:
+ simple:
+ expression: "${exchangeProperty.debezium-row}"
+ - removeProperty:
+ name: debezium-row
+ # a delete has no row after it: send the row before it
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation} == 'd'"
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumBefore}"
+ - convertBodyTo:
+ type: java.util.Map
+ - marshal:
+ json: {}
+ # the Kafka Connect objects of the component, which other
systems cannot read
+ - removeHeaders:
+ pattern: CamelDebezium*
+ - to:
+ uri: kamelet:sink
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 6fe13ef1d..eccbf6845 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -669,13 +669,33 @@
"group" : "SQL",
"namespace" : "Database",
"provider" : "Apache Software Foundation"
+ }, {
+ "name" : "debezium-mysql-source",
+ "type" : "source",
+ "supportLevel" : "Preview",
+ "title" : "Debezium MySQL Source",
+ "summary" : "Sends a message for each row inserted, updated or deleted in
the tables of a MySQL database, as it happens (change data capture with
Debezium).",
+ "description" : "Sends a message for each row inserted, updated or deleted
in the tables of a MySQL database, as it happens (change data capture with
Debezium).\n\nUse it to pass the changes of a database on to another system as
they happen, for example to keep a search index or a cache up to date, or to
copy new orders to a queue, without polling the tables. To read rows with a
query again and again, use `mysql-source`.\n\nOutput: the body is JSON text in
bytes, an object with the c [...]
+ "group" : "Debezium",
+ "namespace" : "Database",
+ "provider" : "Apache Software Foundation"
}, {
"name" : "debezium-postgresql-source",
"type" : "source",
"supportLevel" : "Preview",
"title" : "Debezium PostgreSQL Source",
"summary" : "Sends a message for each row inserted, updated or deleted in
the tables of a PostgreSQL database, as it happens (change data capture with
Debezium).",
- "description" : "Sends a message for each row inserted, updated or deleted
in the tables of a PostgreSQL database, as it happens (change data capture with
Debezium).\n\nUse it to pass the changes of a database on to another system as
they happen, for example to keep a search index or a cache up to date, or to
copy new orders to a queue, without polling the tables. To read rows with a
query again and again, use `postgresql-source`.\n\nOutput: the body is JSON
text in bytes, an object [...]
+ "description" : "Sends a message for each row inserted, updated or deleted
in the tables of a PostgreSQL database, as it happens (change data capture with
Debezium).\n\nUse it to pass the changes of a database on to another system as
they happen, for example to keep a search index or a cache up to date, or to
copy new orders to a queue, without polling the tables. To read rows with a
query again and again, use `postgresql-source`.\n\nOutput: the body is JSON
text in bytes, an object [...]
+ "group" : "Debezium",
+ "namespace" : "Database",
+ "provider" : "Apache Software Foundation"
+ }, {
+ "name" : "debezium-sqlserver-source",
+ "type" : "source",
+ "supportLevel" : "Preview",
+ "title" : "Debezium SQL Server Source",
+ "summary" : "Sends a message for each row inserted, updated or deleted in
the tables of a SQL Server database, as it happens (change data capture with
Debezium).",
+ "description" : "Sends a message for each row inserted, updated or deleted
in the tables of a SQL Server database, as it happens (change data capture with
Debezium).\n\nUse it to pass the changes of a database on to another system as
they happen, for example to keep a search index or a cache up to date, or to
copy new orders to a queue, without polling the tables. To read rows with a
query again and again, use `sqlserver-source`.\n\nOutput: the body is JSON text
in bytes, an object w [...]
"group" : "Debezium",
"namespace" : "Database",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/debezium-mysql-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/debezium-mysql-source.kamelet.yaml
new file mode 100644
index 000000000..39d3751d1
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/debezium-mysql-source.kamelet.yaml
@@ -0,0 +1,270 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: debezium-mysql-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmVyc2lvbj0iMS4wIj4KIDxyZWN0IGZpbGw9IiMyNjU1N2MiIHdpZHRoPSIyOCIgaGVpZ2h0PSIyOCIgeD0iLTMwIiB5PSItMzAiIHJ4PSIxLjQiIHJ5PSIxLjQiIHRyYW5zZm9ybT0ibWF0cml4KDAsLTEsLTEsMCwwLDApIi8+CiA8cGF0aCBvcGFjaXR5PSIuMiIgZD0ibTguMDI1NCA4LjAwMDFjLTAuNzgyNS0wLjAxNjYtMS4xNDk0IDAuNTI0NC0wLjk4ODMgMS40NTcgMC4wNTIgMC4zMDA2IDAuMzE1MiAwLjcyOTkgMC44ODI4IDEuNDQxOSAwLjYzMTIyID
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Debezium"
+ camel.apache.org/kamelet.namespace: "Database"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "Debezium MySQL Source"
+ description: |-
+ Sends a message for each row inserted, updated or deleted in the tables
of a MySQL database, as it happens (change data capture with Debezium).
+
+ Use it to pass the changes of a database on to another system as they
happen, for example to keep a search index or a cache up to date, or to copy
new orders to a queue, without polling the tables. To read rows with a query
again and again, use `mysql-source`.
+
+ Output: the body is JSON text in bytes, an object with the column names
as keys, such as `{"id":1,"name":"Tea","price":4.50}`: the row after the
change, and for a delete the row before it. The columns are in the order of the
table. A `DECIMAL` column is a JSON number with its decimals, such as `4.50`,
and a `DATE` column the number of days since 1970-01-01, such as `20454` for
2026-01-01. The `debezium-operation` header says what happened: `c` (insert),
`u` (update), `d` (delete) o [...]
+
+ Good to know: the server must write its binary log (binlog) in the `ROW`
format with the whole row (`binlog_format=ROW` and `binlog_row_image=FULL`, the
defaults of MySQL 8), and the user needs the `SELECT`, `RELOAD`, `SHOW
DATABASES`, `REPLICATION SLAVE` and `REPLICATION CLIENT` privileges. The
Kamelet reads the binlog as a replica of the server does, under the id
`serverId`. On the first start, it by default sends every row of the tables
first (`snapshotMode`). It saves how far i [...]
+ required:
+ - serverName
+ - username
+ - password
+ - serverId
+ - topicPrefix
+ type: object
+ properties:
+ serverName:
+ title: Server Name
+ description: The host name or IP address of the MySQL server, without
the port.
+ type: string
+ example: db.example.com
+ serverPort:
+ title: Server Port
+ description: The port the MySQL server listens on. MySQL uses 3306
unless it was set up otherwise.
+ type: integer
+ default: 3306
+ username:
+ title: Username
+ description: The database user to log in as. It needs the `SELECT`,
`RELOAD`, `SHOW DATABASES`, `REPLICATION SLAVE` and `REPLICATION CLIENT`
privileges.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: Password
+ description: The password of the database user `username`.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ serverId:
+ title: Server Id
+ description: The number the Kamelet uses as a replica of the MySQL
server to read the binlog, such as `5400`. It must differ from the `server_id`
of every MySQL server and of every other client that reads the binlog of the
same servers, the other Kamelets included.
+ type: integer
+ example: 5400
+ topicPrefix:
+ title: Logical Name
+ description: A name for this source of changes, made of letters,
digits, `.`, `_` and `-`. The saved position is stored under this name, so keep
it the same across restarts, and give each Kamelet that reads another server
its own name.
+ type: string
+ pattern: "^[a-zA-Z0-9._-]+$"
+ example: shop
+ tableIncludeList:
+ title: Tables
+ description: The tables whose changes to send, as regular expressions
that match `database.table`, separated by commas, such as
`shop.orders,shop.customers`. When it is not set, the changes of all tables of
all databases are sent, except those of the system databases.
+ type: string
+ example: shop.orders,shop.customers
+ snapshotMode:
+ title: Snapshot Mode
+ description: "Whether to send the rows that are already in the tables
before the changes. `initial` (the default): on the first start, every row of
the tables is sent with the operation `r`, then the changes; after a restart
with a saved position, only the changes since. `no_data`: only the changes made
from the first start on. `always`: every row on each start, then the changes.
`initial_only`: every row on the first start, and no changes. `when_needed`: as
`initial`, and every [...]
+ type: string
+ enum: ["initial", "no_data", "always", "initial_only", "when_needed",
"recovery"]
+ default: initial
+ sslMode:
+ title: TLS Mode
+ description: "Whether the connection to MySQL uses TLS. `preferred`
(the default): TLS when the server offers it, without checking its certificate.
`required`: always TLS, without checking the certificate of the server.
`disabled`: no TLS."
+ type: string
+ enum: ["disabled", "preferred", "required"]
+ default: preferred
+ offsetStorageFileName:
+ title: Position File
+ description: The file where the Kamelet saves how far it got, such as
`/data/offsets.dat`, read again after a restart. It is created when it does not
exist, but its folder must exist and be writable, or the Kamelet fails to
start. A relative name is in the folder the integration runs in. When it is
lost, the changes are sent again as on the first start. Not used when
`offsetStorage` is the Kafka store.
+ type: string
+ default: debezium-mysql-offsets.dat
+ example: /data/offsets.dat
+ offsetStorage:
+ title: Position Store
+ description: "Where the Kamelet saves how far it got.
`org.apache.kafka.connect.storage.FileOffsetBackingStore` (the default): in the
file `offsetStorageFileName`.
`org.apache.kafka.connect.storage.KafkaOffsetBackingStore`: in the Kafka topic
`offsetStorageTopic`, on the Kafka of `offsetStorageBootstrapServers`, for an
integration that has no lasting disk. Use the same kind of store for
`schemaHistory`."
+ type: string
+ enum: ["org.apache.kafka.connect.storage.FileOffsetBackingStore",
"org.apache.kafka.connect.storage.KafkaOffsetBackingStore"]
+ default: org.apache.kafka.connect.storage.FileOffsetBackingStore
+ offsetStorageBootstrapServers:
+ title: Kafka Brokers
+ description: The Kafka brokers of the Kafka stores of `offsetStorage`
and `schemaHistory`, as `host:port` separated by commas. Needed with a Kafka
store. The connection is made without TLS and without a login.
+ type: string
+ example: my-cluster-kafka-bootstrap:9092
+ offsetStorageTopic:
+ title: Position Topic
+ description: The Kafka topic where the Kafka store saves how far the
Kamelet got. It is created when it does not exist. Needed with the Kafka store.
+ type: string
+ example: shop-offsets
+ offsetStoragePartitions:
+ title: Position Topic Partitions
+ description: The number of partitions of the topic
`offsetStorageTopic` when the Kamelet creates it. Needed with the Kafka store.
+ type: integer
+ example: 1
+ offsetStorageReplicationFactor:
+ title: Position Topic Replicas
+ description: The number of copies of the topic `offsetStorageTopic` on
the Kafka brokers when the Kamelet creates it. Needed with the Kafka store.
+ type: integer
+ example: 3
+ schemaHistoryFileName:
+ title: Schema History File
+ description: The file where the Kamelet keeps the structure of the
tables, such as `/data/schema-history.dat`, read again after a restart. It is
created when it does not exist, with its folders. A relative name is in the
folder the integration runs in. Not used when `schemaHistory` is the Kafka
store.
+ type: string
+ default: debezium-mysql-schema-history.dat
+ example: /data/schema-history.dat
+ schemaHistory:
+ title: Schema History Store
+ description: "Where the Kamelet keeps the structure of the tables.
`io.debezium.storage.file.history.FileSchemaHistory` (the default): in the file
`schemaHistoryFileName`.
`io.debezium.storage.kafka.history.KafkaSchemaHistory`: in the Kafka topic
`schemaHistoryTopic`, on the Kafka of `offsetStorageBootstrapServers`, for an
integration that has no lasting disk."
+ type: string
+ enum: ["io.debezium.storage.file.history.FileSchemaHistory",
"io.debezium.storage.kafka.history.KafkaSchemaHistory"]
+ default: io.debezium.storage.file.history.FileSchemaHistory
+ schemaHistoryTopic:
+ title: Schema History Topic
+ description: The Kafka topic where the Kafka store keeps the structure
of the tables. It is created with one partition when it does not exist. Use a
topic of its own, not `offsetStorageTopic`. Needed with the Kafka store.
+ type: string
+ example: shop-schema-history
+ dataTypes:
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The row after the change, or before it for a delete,
as JSON text in bytes."
+ mediaType: application/json
+ headers:
+ debezium-operation:
+ title: Operation
+ description: "What happened to the row: `c` (insert), `u` (update),
`d` (delete) or `r` (read by the snapshot)."
+ type: string
+ debezium-table:
+ title: Table
+ description: The table of the row, as `database.table`, such as
`shop.orders`.
+ type: string
+ debezium-key:
+ title: Key
+ description: The primary key of the row, as JSON text such as
`{"id":1}`.
+ type: string
+ Content-Type:
+ title: Content Type
+ description: Always `application/json`, as the body is JSON text.
+ type: string
+ dependencies:
+ - "camel:jackson3"
+ - "camel:kamelet"
+ - "camel:debezium-mysql"
+ template:
+ from:
+ uri: debezium-mysql
+ parameters:
+ name: "{{topicPrefix}}"
+ databaseHostname: "{{serverName}}"
+ databasePort: "{{serverPort}}"
+ databaseUser: "{{username}}"
+ databasePassword: "RAW({{password}})"
+ databaseServerId: "{{serverId}}"
+ databaseSslMode: "{{sslMode}}"
+ topicPrefix: "{{topicPrefix}}"
+ tableIncludeList: "{{?tableIncludeList}}"
+ snapshotMode: "{{snapshotMode}}"
+ offsetStorage: "{{offsetStorage}}"
+ offsetStorageFileName: "{{offsetStorageFileName}}"
+ offsetStorageTopic: "{{?offsetStorageTopic}}"
+ offsetStoragePartitions: "{{?offsetStoragePartitions}}"
+ offsetStorageReplicationFactor: "{{?offsetStorageReplicationFactor}}"
+ schemaHistoryInternal: "{{schemaHistory}}"
+ schemaHistoryInternalFileFilename: "{{schemaHistoryFileName}}"
+ additionalProperties.bootstrap.servers:
"{{?offsetStorageBootstrapServers}}"
+ additionalProperties.schema.history.internal.kafka.bootstrap.servers:
"{{?offsetStorageBootstrapServers}}"
+ additionalProperties.schema.history.internal.kafka.topic:
"{{?schemaHistoryTopic}}"
+ steps:
+ # only the changes of rows: not the tombstones, heartbeats or schema
changes, which have no row
+ - filter:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation} in 'c,u,d,r'"
+ steps:
+ - setHeader:
+ name: debezium-operation
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation}"
+ - setHeader:
+ name: debezium-table
+ expression:
+ simple:
+ expression:
"${header.CamelDebeziumSourceMetadata[db]}.${header.CamelDebeziumSourceMetadata[table]}"
+ # the key as JSON text
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header.CamelDebeziumKey} != null"
+ steps:
+ - setProperty:
+ name: debezium-row
+ expression:
+ simple:
+ expression: "${body}"
+ - setBody:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumKey}"
+ - convertBodyTo:
+ type: java.util.Map
+ - marshal:
+ json: {}
+ - setHeader:
+ name: debezium-key
+ expression:
+ simple:
+ expression: "${bodyAs(String)}"
+ - setBody:
+ expression:
+ simple:
+ expression: "${exchangeProperty.debezium-row}"
+ - removeProperty:
+ name: debezium-row
+ # a delete has no row after it: send the row before it
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation} == 'd'"
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumBefore}"
+ - convertBodyTo:
+ type: java.util.Map
+ - marshal:
+ json: {}
+ # the Kafka Connect objects of the component, which other
systems cannot read
+ - removeHeaders:
+ pattern: CamelDebezium*
+ - to:
+ uri: kamelet:sink
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/debezium-postgresql-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/debezium-postgresql-source.kamelet.yaml
index 2f7425610..31d8a851f 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/debezium-postgresql-source.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/debezium-postgresql-source.kamelet.yaml
@@ -38,7 +38,7 @@ spec:
Output: the body is JSON text in bytes, an object with the column names
as keys, such as `{"id":1,"name":"Tea","price":4.50}`: the row after the
change, and for a delete the row before it. The columns are in the order of the
table. A `NUMERIC` column is a JSON number with its decimals, such as `4.50`,
and a `DATE` column the number of days since 1970-01-01, such as `20454` for
2026-01-01. The `debezium-operation` header says what happened: `c` (insert),
`u` (update), `d` (delete) o [...]
- Good to know: the server must run with `wal_level=logical`, and the user
needs the `REPLICATION` attribute and the right to read the tables. On the
first start, the Kamelet creates a replication slot named `slotName` and a
publication named `publicationName` in the database, and by default sends every
row of the tables first (`snapshotMode`). It saves how far it got in the file
`offsetStorageFileName`, or in a Kafka topic, when it stops and once a minute
while it runs, and after a [...]
+ Good to know: the server must run with `wal_level=logical`, and the user
needs the `REPLICATION` attribute and the right to read the tables. When the
server is not set up as needed, such as with `wal_level=replica`, the Kamelet
fails to start, and the error says why. On the first start, the Kamelet creates
a replication slot named `slotName` and a publication named `publicationName`
in the database, and by default sends every row of the tables first
(`snapshotMode`). It saves how f [...]
required:
- serverName
- username
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/debezium-sqlserver-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/debezium-sqlserver-source.kamelet.yaml
new file mode 100644
index 000000000..cd731fdb7
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/debezium-sqlserver-source.kamelet.yaml
@@ -0,0 +1,276 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: debezium-sqlserver-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Debezium"
+ camel.apache.org/kamelet.namespace: "Database"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "Debezium SQL Server Source"
+ description: |-
+ Sends a message for each row inserted, updated or deleted in the tables
of a SQL Server database, as it happens (change data capture with Debezium).
+
+ Use it to pass the changes of a database on to another system as they
happen, for example to keep a search index or a cache up to date, or to copy
new orders to a queue, without polling the tables. To read rows with a query
again and again, use `sqlserver-source`.
+
+ Output: the body is JSON text in bytes, an object with the column names
as keys, such as `{"id":1,"name":"Tea","price":4.50}`: the row after the
change, and for a delete the row before it. The columns are in the order of the
table. A `DECIMAL` column is a JSON number with its decimals, such as `4.50`,
and a `DATE` column the number of days since 1970-01-01, such as `20454` for
2026-01-01. The `debezium-operation` header says what happened: `c` (insert),
`u` (update), `d` (delete) o [...]
+
+ Good to know: the Kamelet reads the changes that the change data capture
(CDC) of SQL Server records, so CDC must be enabled on the database, with `EXEC
sys.sp_cdc_enable_db`, and on each table, such as with `EXEC
sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = 'orders',
@role_name = NULL`, which needs a member of `sysadmin`. SQL Server Agent must
run, as its jobs copy the changes into the change tables of CDC. The changes of
a table without CDC are not sent. The use [...]
+ required:
+ - serverName
+ - username
+ - password
+ - databaseName
+ - topicPrefix
+ type: object
+ properties:
+ serverName:
+ title: Server Name
+ description: The host name or IP address of the SQL Server server,
without the port.
+ type: string
+ example: db.example.com
+ serverPort:
+ title: Server Port
+ description: The port the SQL Server server listens on. SQL Server
uses 1433 unless it was set up otherwise.
+ type: integer
+ default: 1433
+ username:
+ title: Username
+ description: The database user to log in as. It needs to read the
tables and the change tables of CDC, as a member of the `db_owner` role of the
database does.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: Password
+ description: The password of the database user `username`.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ databaseName:
+ title: Database Name
+ description: The name of the database whose changes to send. CDC must
be enabled on it.
+ type: string
+ example: shop
+ topicPrefix:
+ title: Logical Name
+ description: A name for this source of changes, made of letters,
digits, `.`, `_` and `-`. The saved position is stored under this name, so keep
it the same across restarts, and give each Kamelet that reads another database
its own name.
+ type: string
+ pattern: "^[a-zA-Z0-9._-]+$"
+ example: shop
+ tableIncludeList:
+ title: Tables
+ description: The tables whose changes to send, as regular expressions
that match `schema.table`, separated by commas, such as
`dbo.orders,dbo.customers`. When it is not set, the changes of all tables with
CDC are sent.
+ type: string
+ example: dbo.orders,dbo.customers
+ snapshotMode:
+ title: Snapshot Mode
+ description: "Whether to send the rows that are already in the tables
before the changes. `initial` (the default): on the first start, every row of
the tables is sent with the operation `r`, then the changes; after a restart
with a saved position, only the changes since. `no_data`: only the changes made
from the first start on. `always`: every row on each start, then the changes.
`initial_only`: every row on the first start, and no changes. `when_needed`: as
`initial`, and every [...]
+ type: string
+ enum: ["initial", "no_data", "always", "initial_only", "when_needed",
"recovery"]
+ default: initial
+ encrypt:
+ title: Encrypt Connection
+ description: Whether the connection to SQL Server is encrypted with
TLS. When true, the certificate of the server must be trusted by Java, or
`trustServerCertificate` must be true.
+ type: boolean
+ default: true
+ trustServerCertificate:
+ title: Trust Server Certificate
+ description: 'Whether to accept the certificate of the server without
checking it, as needed for a server with a self-signed certificate. Only for
development and tests: the connection can then be intercepted.'
+ type: boolean
+ default: false
+ offsetStorageFileName:
+ title: Position File
+ description: The file where the Kamelet saves how far it got, such as
`/data/offsets.dat`, read again after a restart. It is created when it does not
exist, but its folder must exist and be writable, or the Kamelet fails to
start. A relative name is in the folder the integration runs in. When it is
lost, the changes are sent again as on the first start. Not used when
`offsetStorage` is the Kafka store.
+ type: string
+ default: debezium-sqlserver-offsets.dat
+ example: /data/offsets.dat
+ offsetStorage:
+ title: Position Store
+ description: "Where the Kamelet saves how far it got.
`org.apache.kafka.connect.storage.FileOffsetBackingStore` (the default): in the
file `offsetStorageFileName`.
`org.apache.kafka.connect.storage.KafkaOffsetBackingStore`: in the Kafka topic
`offsetStorageTopic`, on the Kafka of `offsetStorageBootstrapServers`, for an
integration that has no lasting disk. Use the same kind of store for
`schemaHistory`."
+ type: string
+ enum: ["org.apache.kafka.connect.storage.FileOffsetBackingStore",
"org.apache.kafka.connect.storage.KafkaOffsetBackingStore"]
+ default: org.apache.kafka.connect.storage.FileOffsetBackingStore
+ offsetStorageBootstrapServers:
+ title: Kafka Brokers
+ description: The Kafka brokers of the Kafka stores of `offsetStorage`
and `schemaHistory`, as `host:port` separated by commas. Needed with a Kafka
store. The connection is made without TLS and without a login.
+ type: string
+ example: my-cluster-kafka-bootstrap:9092
+ offsetStorageTopic:
+ title: Position Topic
+ description: The Kafka topic where the Kafka store saves how far the
Kamelet got. It is created when it does not exist. Needed with the Kafka store.
+ type: string
+ example: shop-offsets
+ offsetStoragePartitions:
+ title: Position Topic Partitions
+ description: The number of partitions of the topic
`offsetStorageTopic` when the Kamelet creates it. Needed with the Kafka store.
+ type: integer
+ example: 1
+ offsetStorageReplicationFactor:
+ title: Position Topic Replicas
+ description: The number of copies of the topic `offsetStorageTopic` on
the Kafka brokers when the Kamelet creates it. Needed with the Kafka store.
+ type: integer
+ example: 3
+ schemaHistoryFileName:
+ title: Schema History File
+ description: The file where the Kamelet keeps the structure of the
tables, such as `/data/schema-history.dat`, read again after a restart. It is
created when it does not exist, with its folders. A relative name is in the
folder the integration runs in. Not used when `schemaHistory` is the Kafka
store.
+ type: string
+ default: debezium-sqlserver-schema-history.dat
+ example: /data/schema-history.dat
+ schemaHistory:
+ title: Schema History Store
+ description: "Where the Kamelet keeps the structure of the tables.
`io.debezium.storage.file.history.FileSchemaHistory` (the default): in the file
`schemaHistoryFileName`.
`io.debezium.storage.kafka.history.KafkaSchemaHistory`: in the Kafka topic
`schemaHistoryTopic`, on the Kafka of `offsetStorageBootstrapServers`, for an
integration that has no lasting disk."
+ type: string
+ enum: ["io.debezium.storage.file.history.FileSchemaHistory",
"io.debezium.storage.kafka.history.KafkaSchemaHistory"]
+ default: io.debezium.storage.file.history.FileSchemaHistory
+ schemaHistoryTopic:
+ title: Schema History Topic
+ description: The Kafka topic where the Kafka store keeps the structure
of the tables. It is created with one partition when it does not exist. Use a
topic of its own, not `offsetStorageTopic`. Needed with the Kafka store.
+ type: string
+ example: shop-schema-history
+ dataTypes:
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The row after the change, or before it for a delete,
as JSON text in bytes."
+ mediaType: application/json
+ headers:
+ debezium-operation:
+ title: Operation
+ description: "What happened to the row: `c` (insert), `u` (update),
`d` (delete) or `r` (read by the snapshot)."
+ type: string
+ debezium-table:
+ title: Table
+ description: The table of the row, as `schema.table`, such as
`dbo.orders`.
+ type: string
+ debezium-key:
+ title: Key
+ description: The primary key of the row, as JSON text such as
`{"id":1}`.
+ type: string
+ Content-Type:
+ title: Content Type
+ description: Always `application/json`, as the body is JSON text.
+ type: string
+ dependencies:
+ - "camel:jackson3"
+ - "camel:kamelet"
+ - "camel:debezium-sqlserver"
+ template:
+ from:
+ uri: debezium-sqlserver
+ parameters:
+ name: "{{topicPrefix}}"
+ databaseHostname: "{{serverName}}"
+ databasePort: "{{serverPort}}"
+ databaseUser: "{{username}}"
+ databasePassword: "RAW({{password}})"
+ databaseNames: "{{databaseName}}"
+ topicPrefix: "{{topicPrefix}}"
+ tableIncludeList: "{{?tableIncludeList}}"
+ snapshotMode: "{{snapshotMode}}"
+ offsetStorage: "{{offsetStorage}}"
+ offsetStorageFileName: "{{offsetStorageFileName}}"
+ offsetStorageTopic: "{{?offsetStorageTopic}}"
+ offsetStoragePartitions: "{{?offsetStoragePartitions}}"
+ offsetStorageReplicationFactor: "{{?offsetStorageReplicationFactor}}"
+ schemaHistoryInternal: "{{schemaHistory}}"
+ schemaHistoryInternalFileFilename: "{{schemaHistoryFileName}}"
+ # the settings of the JDBC driver of SQL Server
+ additionalProperties.database.encrypt: "{{encrypt}}"
+ additionalProperties.database.trustServerCertificate:
"{{trustServerCertificate}}"
+ additionalProperties.bootstrap.servers:
"{{?offsetStorageBootstrapServers}}"
+ additionalProperties.schema.history.internal.kafka.bootstrap.servers:
"{{?offsetStorageBootstrapServers}}"
+ additionalProperties.schema.history.internal.kafka.topic:
"{{?schemaHistoryTopic}}"
+ steps:
+ # only the changes of rows: not the tombstones, heartbeats or schema
changes, which have no row
+ - filter:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation} in 'c,u,d,r'"
+ steps:
+ - setHeader:
+ name: debezium-operation
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation}"
+ - setHeader:
+ name: debezium-table
+ expression:
+ simple:
+ expression:
"${header.CamelDebeziumSourceMetadata[schema]}.${header.CamelDebeziumSourceMetadata[table]}"
+ # the key as JSON text
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header.CamelDebeziumKey} != null"
+ steps:
+ - setProperty:
+ name: debezium-row
+ expression:
+ simple:
+ expression: "${body}"
+ - setBody:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumKey}"
+ - convertBodyTo:
+ type: java.util.Map
+ - marshal:
+ json: {}
+ - setHeader:
+ name: debezium-key
+ expression:
+ simple:
+ expression: "${bodyAs(String)}"
+ - setBody:
+ expression:
+ simple:
+ expression: "${exchangeProperty.debezium-row}"
+ - removeProperty:
+ name: debezium-row
+ # a delete has no row after it: send the row before it
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header.CamelDebeziumOperation} == 'd'"
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "${header.CamelDebeziumBefore}"
+ - convertBodyTo:
+ type: java.util.Map
+ - marshal:
+ json: {}
+ # the Kafka Connect objects of the component, which other
systems cannot read
+ - removeHeaders:
+ pattern: CamelDebezium*
+ - to:
+ uri: kamelet:sink
diff --git
a/tests/camel-kamelets-itest/src/test/resources/citrus-application.properties
b/tests/camel-kamelets-itest/src/test/resources/citrus-application.properties
new file mode 100644
index 000000000..3149b4517
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/citrus-application.properties
@@ -0,0 +1,17 @@
+# 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.
+
+# write the output of each Camel integration to the work folder
(.citrus-jbang), which CI uploads when a run fails
+citrus.camel.jbang.dump.integration.output=true
diff --git
a/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-init.sql
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-init.sql
new file mode 100644
index 000000000..9a9247082
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-init.sql
@@ -0,0 +1,5 @@
+CREATE TABLE products (id INTEGER PRIMARY KEY, name VARCHAR(100), price
DECIMAL(10,2), added DATE, note VARCHAR(100));
+INSERT INTO products VALUES (1, 'Tea', 4.50, '2026-01-01', 'not sent');
+CREATE TABLE notes (id INTEGER PRIMARY KEY, text VARCHAR(100));
+-- the privileges the description of the Kamelet names, and no more
+GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON
*.* TO 'test'@'%';
diff --git
a/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-kafka-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-kafka-route.citrus.it.yaml
new file mode 100644
index 000000000..5e74953de
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-kafka-route.citrus.it.yaml
@@ -0,0 +1,159 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: debezium-mysql-source-kafka-route-test
+actions:
+ # Start MySQL with the binlog in the ROW format with the whole row, and a
table of one row; the init script gives
+ # the user the privileges the Kamelet needs
+ - testcontainers:
+ start:
+ container:
+ name: "mysql"
+ image: "mysql:8.4.7"
+ command: "mysqld --binlog-format=ROW --binlog-row-image=FULL"
+ autoRemove: true
+ startUpTimeout: 120
+ exposedPorts:
+ - 3306
+ env:
+ - name: "MYSQL_DATABASE"
+ value: "testdb"
+ - name: "MYSQL_USER"
+ value: "test"
+ - name: "MYSQL_PASSWORD"
+ value: "test"
+ - name: "MYSQL_ROOT_PASSWORD"
+ value: "root"
+ volumeMounts:
+ - file: "database/debezium/debezium-mysql-init.sql"
+ mountPath: "/docker-entrypoint-initdb.d/init.sql"
+ # only the server started after the init scripts listens on port 3306
+ waitFor:
+ logMessage: '.*ready for connections.*port: 3306 .*'
+
+ # A Kafka to keep the position and the schema history in
+ - testcontainers:
+ start:
+ kafka:
+ implementation: "apache"
+ version: "4.4.0"
+
+ # The first run sends the row already in the table (the snapshot), and saves
its position in Kafka when it stops
+ # the test stops each run itself: Citrus removes the containers before the
integrations it stops at the end, and
+ # without Kafka the stop waits to save the position until `camel stop` times
out
+ - camel:
+ cli:
+ run:
+ autoRemove: false
+ waitForRunningState: false
+ integration:
+ name: "debezium-mysql-kafka-first"
+ file: "database/debezium/debezium-mysql-source-kafka-route.yaml"
+ systemProperties:
+ properties:
+ - name: "db.serverName"
+ value: "${CITRUS_TESTCONTAINERS_MYSQL_HOST}"
+ - name: "db.serverPort"
+ value: "${CITRUS_TESTCONTAINERS_MYSQL_PORT}"
+ - name: "kafka.bootstrapServers"
+ value: "${CITRUS_TESTCONTAINERS_KAFKA_BOOTSTRAP_SERVERS}"
+ - name: "run.name"
+ value: "first"
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Operation"
+ value: 'r'
+ body:
+ data: '{"id":1,"name":"Tea","price":4.50,"added":20454,"note":"not
sent"}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ - camel:
+ cli:
+ stop:
+ integration: "debezium-mysql-kafka-first"
+
+ # A row inserted while no integration runs
+ - createVariables:
+ variables:
+ - name: "db.container"
+ value: "mysql"
+ - name: "db.sql"
+ value: |-
+ INSERT INTO products VALUES (2, 'Coffee', 3.20, '2026-03-01', 'x');
+ - groovy:
+ script:
+ file: "database/sql.groovy"
+
+ # The second run reads the position and the schema history from Kafka: it
sends only the new row, not the snapshot again
+ - camel:
+ cli:
+ run:
+ autoRemove: false
+ waitForRunningState: false
+ integration:
+ name: "debezium-mysql-kafka-second"
+ file: "database/debezium/debezium-mysql-source-kafka-route.yaml"
+ systemProperties:
+ properties:
+ - name: "db.serverName"
+ value: "${CITRUS_TESTCONTAINERS_MYSQL_HOST}"
+ - name: "db.serverPort"
+ value: "${CITRUS_TESTCONTAINERS_MYSQL_PORT}"
+ - name: "kafka.bootstrapServers"
+ value: "${CITRUS_TESTCONTAINERS_KAFKA_BOOTSTRAP_SERVERS}"
+ - name: "run.name"
+ value: "second"
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'second'
+ - name: "X-Operation"
+ value: 'c'
+ body:
+ data:
'{"id":2,"name":"Coffee","price":3.20,"added":20513,"note":"x"}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ - camel:
+ cli:
+ stop:
+ integration: "debezium-mysql-kafka-second"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-kafka-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-kafka-route.yaml
new file mode 100644
index 000000000..7e45f81ba
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-kafka-route.yaml
@@ -0,0 +1,44 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+- route:
+ from:
+ uri: "kamelet:debezium-mysql-source"
+ parameters:
+ serverName: "{{db.serverName}}"
+ serverPort: "{{db.serverPort}}"
+ username: "test"
+ password: "test"
+ serverId: 5401
+ topicPrefix: "shop"
+ tableIncludeList: "testdb.products"
+ # the position and the schema history are kept in Kafka topics, not in
files
+ offsetStorage:
"org.apache.kafka.connect.storage.KafkaOffsetBackingStore"
+ offsetStorageBootstrapServers: "{{kafka.bootstrapServers}}"
+ offsetStorageTopic: "shop-offsets"
+ offsetStoragePartitions: 1
+ offsetStorageReplicationFactor: 1
+ schemaHistory: "io.debezium.storage.kafka.history.KafkaSchemaHistory"
+ schemaHistoryTopic: "shop-schema-history"
+ steps:
+ - setHeader:
+ name: X-Operation
+ simple: "${header.debezium-operation}"
+ - setHeader:
+ name: X-Run
+ simple: "{{run.name}}"
+ - to:
+ uri: "{{http.sink.url}}/result"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-route.citrus.it.yaml
new file mode 100644
index 000000000..71730cf4b
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-route.citrus.it.yaml
@@ -0,0 +1,300 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: debezium-mysql-source-route-test
+variables:
+ # new files for each run, so that no saved position of an earlier run is
used: the position file in a folder that
+ # exists, the schema history file in a folder that does not exist yet, which
the Kamelet creates
+ - name: "storageId"
+ value: "citrus:randomUUID()"
+ - name: "offsetFile"
+ value: "citrus:concat(citrus:systemProperty('java.io.tmpdir'),
'/debezium-mysql-offsets-', ${storageId}, '.dat')"
+ - name: "historyFile"
+ value: "citrus:concat(citrus:systemProperty('java.io.tmpdir'),
'/debezium-mysql-history-', ${storageId}, '/history.dat')"
+actions:
+ # Start MySQL with the binlog in the ROW format with the whole row, and a
table of one row; the init script gives
+ # the user the privileges the Kamelet needs
+ - testcontainers:
+ start:
+ container:
+ name: "mysql"
+ image: "mysql:8.4.7"
+ command: "mysqld --binlog-format=ROW --binlog-row-image=FULL"
+ autoRemove: true
+ startUpTimeout: 120
+ exposedPorts:
+ - 3306
+ env:
+ - name: "MYSQL_DATABASE"
+ value: "testdb"
+ - name: "MYSQL_USER"
+ value: "test"
+ - name: "MYSQL_PASSWORD"
+ value: "test"
+ - name: "MYSQL_ROOT_PASSWORD"
+ value: "root"
+ volumeMounts:
+ - file: "database/debezium/debezium-mysql-init.sql"
+ mountPath: "/docker-entrypoint-initdb.d/init.sql"
+ # only the server started after the init scripts listens on port 3306
+ waitFor:
+ logMessage: '.*ready for connections.*port: 3306 .*'
+
+ # The first run sends the row already in the table (the snapshot), then the
changes
+ # the test stops each run itself, so Citrus must not stop it at the end,
after the container is removed
+ - camel:
+ cli:
+ run:
+ autoRemove: false
+ waitForRunningState: false
+ integration:
+ name: "debezium-mysql-first"
+ file: "database/debezium/debezium-mysql-source-route.yaml"
+ systemProperties:
+ properties:
+ - name: "db.serverName"
+ value: "${CITRUS_TESTCONTAINERS_MYSQL_HOST}"
+ - name: "db.serverPort"
+ value: "${CITRUS_TESTCONTAINERS_MYSQL_PORT}"
+ - name: "db.offsetFile"
+ value: "${offsetFile}"
+ - name: "db.historyFile"
+ value: "${historyFile}"
+ - name: "run.name"
+ value: "first"
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ # any other option of the connector, for all its Kamelets
+ - name: "camel.component.debezium-mysql.columnExcludeList"
+ value: "testdb.products.note"
+
+ # The snapshot: the row as it is, as JSON text in bytes, with the columns in
the order of the table; the note column
+ # is left out by columnExcludeList
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'r'
+ - name: "X-Table"
+ value: 'testdb.products'
+ - name: "X-Key"
+ value: '{"id":1}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":1,"name":"Tea","price":4.50,"added":20454}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # An insert, an update and a delete
+ - createVariables:
+ variables:
+ - name: "db.container"
+ value: "mysql"
+ - name: "db.sql"
+ value: |-
+ INSERT INTO products VALUES (2, 'Coffee', 3.20, '2026-03-01', 'not
sent');
+ UPDATE products SET price = 5.00 WHERE id = 1;
+ DELETE FROM products WHERE id = 2;
+ - groovy:
+ script:
+ file: "database/sql.groovy"
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'c'
+ - name: "X-Table"
+ value: 'testdb.products'
+ - name: "X-Key"
+ value: '{"id":2}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":2,"name":"Coffee","price":3.20,"added":20513}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'u'
+ - name: "X-Table"
+ value: 'testdb.products'
+ - name: "X-Key"
+ value: '{"id":1}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":1,"name":"Tea","price":5.00,"added":20454}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # A delete sends the row before it, with all its columns
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'd'
+ - name: "X-Table"
+ value: 'testdb.products'
+ - name: "X-Key"
+ value: '{"id":2}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":2,"name":"Coffee","price":3.20,"added":20513}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # Stop, change rows while no integration runs, and start again with the same
position and schema history files
+ - camel:
+ cli:
+ stop:
+ integration: "debezium-mysql-first"
+ - createVariables:
+ variables:
+ - name: "db.container"
+ value: "mysql"
+ - name: "db.sql"
+ value: |-
+ INSERT INTO notes VALUES (1, 'not in tableIncludeList, so not
sent');
+ INSERT INTO products VALUES (3, 'Juice', 2.10, '2026-01-01', 'not
sent');
+ - groovy:
+ script:
+ file: "database/sql.groovy"
+ - camel:
+ cli:
+ run:
+ autoRemove: false
+ waitForRunningState: false
+ integration:
+ name: "debezium-mysql-second"
+ file: "database/debezium/debezium-mysql-source-route.yaml"
+ systemProperties:
+ properties:
+ - name: "db.serverName"
+ value: "${CITRUS_TESTCONTAINERS_MYSQL_HOST}"
+ - name: "db.serverPort"
+ value: "${CITRUS_TESTCONTAINERS_MYSQL_PORT}"
+ - name: "db.offsetFile"
+ value: "${offsetFile}"
+ - name: "db.historyFile"
+ value: "${historyFile}"
+ - name: "run.name"
+ value: "second"
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ # any other option of the connector, for all its Kamelets
+ - name: "camel.component.debezium-mysql.columnExcludeList"
+ value: "testdb.products.note"
+
+ # The second run sends only the change of products made while it was
stopped, not the snapshot or the changes sent before
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'second'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'c'
+ - name: "X-Table"
+ value: 'testdb.products'
+ - name: "X-Key"
+ value: '{"id":3}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":3,"name":"Juice","price":2.10,"added":20454}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ - camel:
+ cli:
+ stop:
+ integration: "debezium-mysql-second"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-route.yaml
new file mode 100644
index 000000000..d24ec391c
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-mysql-source-route.yaml
@@ -0,0 +1,57 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+- route:
+ from:
+ uri: "kamelet:debezium-mysql-source"
+ parameters:
+ serverName: "{{db.serverName}}"
+ serverPort: "{{db.serverPort}}"
+ username: "test"
+ password: "test"
+ serverId: 5400
+ topicPrefix: "shop"
+ tableIncludeList: "testdb.products"
+ # the container has a certificate of its own, which is not checked
+ sslMode: "required"
+ offsetStorageFileName: "{{db.offsetFile}}"
+ schemaHistoryFileName: "{{db.historyFile}}"
+ steps:
+ # what the Kamelet gives: the Java type of the body, the Content-Type
and its headers
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Content-Type
+ simple: "ct=${header.Content-Type}"
+ - setHeader:
+ name: X-Operation
+ simple: "${header.debezium-operation}"
+ - setHeader:
+ name: X-Table
+ simple: "${header.debezium-table}"
+ - setHeader:
+ name: X-Key
+ simple: "${header.debezium-key}"
+ # the headers of the component are removed
+ - setHeader:
+ name: X-Component-Headers
+ simple: "op=${header.CamelDebeziumOperation}
key=${header.CamelDebeziumKey}"
+ - setHeader:
+ name: X-Run
+ simple: "{{run.name}}"
+ - to:
+ uri: "{{http.sink.url}}/result"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-sqlserver-source-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-sqlserver-source-route.citrus.it.yaml
new file mode 100644
index 000000000..c30b94107
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-sqlserver-source-route.citrus.it.yaml
@@ -0,0 +1,320 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: debezium-sqlserver-source-route-test
+variables:
+ # new files for each run, so that no saved position of an earlier run is
used: the position file in a folder that
+ # exists, the schema history file in a folder that does not exist yet, which
the Kamelet creates
+ - name: "storageId"
+ value: "citrus:randomUUID()"
+ - name: "offsetFile"
+ value: "citrus:concat(citrus:systemProperty('java.io.tmpdir'),
'/debezium-sqlserver-offsets-', ${storageId}, '.dat')"
+ - name: "historyFile"
+ value: "citrus:concat(citrus:systemProperty('java.io.tmpdir'),
'/debezium-sqlserver-history-', ${storageId}, '/history.dat')"
+actions:
+ # Start SQL Server with SQL Server Agent, whose jobs copy the changes into
the change tables of CDC
+ - testcontainers:
+ start:
+ container:
+ name: "sqlserver"
+ image: "mcr.microsoft.com/mssql/server:2022-CU28-ubuntu-22.04"
+ autoRemove: true
+ startUpTimeout: 180
+ exposedPorts:
+ - 1433
+ env:
+ - name: "ACCEPT_EULA"
+ value: "Y"
+ - name: "MSSQL_SA_PASSWORD"
+ value: "Citrus-Test-1"
+ - name: "MSSQL_AGENT_ENABLED"
+ value: "true"
+ waitFor:
+ logMessage: '.*SQL Server is now ready for client connections.*'
+
+ # A table of one row with CDC, a table without CDC, and a user in the
db_owner role of the database
+ - createVariables:
+ variables:
+ - name: "db.container"
+ value: "sqlserver"
+ - name: "db.sql"
+ value: |-
+ CREATE DATABASE testdb
+ GO
+ USE testdb
+ CREATE TABLE products (id INT PRIMARY KEY, name VARCHAR(100),
price DECIMAL(10,2), added DATE, note VARCHAR(100));
+ INSERT INTO products VALUES (1, 'Tea', 4.50, '2026-01-01', 'not
sent');
+ CREATE TABLE notes (id INT PRIMARY KEY, text VARCHAR(100));
+ CREATE LOGIN test WITH PASSWORD = 'Citrus-Test-2', CHECK_POLICY =
OFF;
+ CREATE USER test FOR LOGIN test;
+ ALTER ROLE db_owner ADD MEMBER test;
+ EXEC sys.sp_cdc_enable_db;
+ EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name
= 'products', @role_name = NULL;
+ - repeatOnError:
+ until: "i > 30"
+ autoSleep: 1000
+ actions:
+ - groovy:
+ script:
+ file: "database/sql.groovy"
+
+ # The first run sends the row already in the table (the snapshot), then the
changes
+ # the test stops each run itself, so Citrus must not stop it at the end,
after the container is removed
+ - camel:
+ cli:
+ run:
+ autoRemove: false
+ waitForRunningState: false
+ integration:
+ name: "debezium-sqlserver-first"
+ file: "database/debezium/debezium-sqlserver-source-route.yaml"
+ systemProperties:
+ properties:
+ - name: "db.serverName"
+ value: "${CITRUS_TESTCONTAINERS_SQLSERVER_HOST}"
+ - name: "db.serverPort"
+ value: "${CITRUS_TESTCONTAINERS_SQLSERVER_PORT}"
+ - name: "db.offsetFile"
+ value: "${offsetFile}"
+ - name: "db.historyFile"
+ value: "${historyFile}"
+ - name: "run.name"
+ value: "first"
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ # any other option of the connector, for all its Kamelets
+ - name: "camel.component.debezium-sqlserver.columnExcludeList"
+ value: "dbo.products.note"
+
+ # The snapshot: the row as it is, as JSON text in bytes, with the columns in
the order of the table; the note column
+ # is left out by columnExcludeList
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'r'
+ - name: "X-Table"
+ value: 'dbo.products'
+ - name: "X-Key"
+ value: '{"id":1}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":1,"name":"Tea","price":4.50,"added":20454}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # An insert, an update and a delete
+ - createVariables:
+ variables:
+ - name: "db.container"
+ value: "sqlserver"
+ - name: "db.sql"
+ value: |-
+ USE testdb
+ INSERT INTO products VALUES (2, 'Coffee', 3.20, '2026-03-01', 'not
sent');
+ UPDATE products SET price = 5.00 WHERE id = 1;
+ DELETE FROM products WHERE id = 2;
+ - groovy:
+ script:
+ file: "database/sql.groovy"
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'c'
+ - name: "X-Table"
+ value: 'dbo.products'
+ - name: "X-Key"
+ value: '{"id":2}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":2,"name":"Coffee","price":3.20,"added":20513}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'u'
+ - name: "X-Table"
+ value: 'dbo.products'
+ - name: "X-Key"
+ value: '{"id":1}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":1,"name":"Tea","price":5.00,"added":20454}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # A delete sends the row before it, with all its columns
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'first'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'd'
+ - name: "X-Table"
+ value: 'dbo.products'
+ - name: "X-Key"
+ value: '{"id":2}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":2,"name":"Coffee","price":3.20,"added":20513}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # Stop, change rows while no integration runs, and start again with the same
position and schema history files
+ - camel:
+ cli:
+ stop:
+ integration: "debezium-sqlserver-first"
+ - createVariables:
+ variables:
+ - name: "db.container"
+ value: "sqlserver"
+ - name: "db.sql"
+ value: |-
+ USE testdb
+ INSERT INTO notes VALUES (1, 'a table without CDC, so not sent');
+ INSERT INTO products VALUES (3, 'Juice', 2.10, '2026-01-01', 'not
sent');
+ - groovy:
+ script:
+ file: "database/sql.groovy"
+ - camel:
+ cli:
+ run:
+ autoRemove: false
+ waitForRunningState: false
+ integration:
+ name: "debezium-sqlserver-second"
+ file: "database/debezium/debezium-sqlserver-source-route.yaml"
+ systemProperties:
+ properties:
+ - name: "db.serverName"
+ value: "${CITRUS_TESTCONTAINERS_SQLSERVER_HOST}"
+ - name: "db.serverPort"
+ value: "${CITRUS_TESTCONTAINERS_SQLSERVER_PORT}"
+ - name: "db.offsetFile"
+ value: "${offsetFile}"
+ - name: "db.historyFile"
+ value: "${historyFile}"
+ - name: "run.name"
+ value: "second"
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ # any other option of the connector, for all its Kamelets
+ - name: "camel.component.debezium-sqlserver.columnExcludeList"
+ value: "dbo.products.note"
+
+ # The second run sends only the change of products made while it was
stopped, not the snapshot or the changes sent before
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Run"
+ value: 'second'
+ - name: "X-Body-Type"
+ value: '[B'
+ - name: "X-Content-Type"
+ value: 'ct=application/json'
+ - name: "X-Operation"
+ value: 'c'
+ - name: "X-Table"
+ value: 'dbo.products'
+ - name: "X-Key"
+ value: '{"id":3}'
+ - name: "X-Component-Headers"
+ value: 'op= key='
+ body:
+ data: '{"id":3,"name":"Juice","price":2.10,"added":20454}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ - camel:
+ cli:
+ stop:
+ integration: "debezium-sqlserver-second"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-sqlserver-source-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-sqlserver-source-route.yaml
new file mode 100644
index 000000000..41bef67d7
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/database/debezium/debezium-sqlserver-source-route.yaml
@@ -0,0 +1,56 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+- route:
+ from:
+ uri: "kamelet:debezium-sqlserver-source"
+ parameters:
+ serverName: "{{db.serverName}}"
+ serverPort: "{{db.serverPort}}"
+ username: "test"
+ password: "Citrus-Test-2"
+ databaseName: "testdb"
+ topicPrefix: "shop"
+ # the container has a self-signed certificate
+ trustServerCertificate: true
+ offsetStorageFileName: "{{db.offsetFile}}"
+ schemaHistoryFileName: "{{db.historyFile}}"
+ steps:
+ # what the Kamelet gives: the Java type of the body, the Content-Type
and its headers
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Content-Type
+ simple: "ct=${header.Content-Type}"
+ - setHeader:
+ name: X-Operation
+ simple: "${header.debezium-operation}"
+ - setHeader:
+ name: X-Table
+ simple: "${header.debezium-table}"
+ - setHeader:
+ name: X-Key
+ simple: "${header.debezium-key}"
+ # the headers of the component are removed
+ - setHeader:
+ name: X-Component-Headers
+ simple: "op=${header.CamelDebeziumOperation}
key=${header.CamelDebeziumKey}"
+ - setHeader:
+ name: X-Run
+ simple: "{{run.name}}"
+ - to:
+ uri: "{{http.sink.url}}/result"