This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit d04c0e97443f36c423de249bac4fb9122b5a1b7c Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Mon Feb 19 11:34:59 2024 +0100 CAMEL-20410: documentation fixes for camel-debezium-mongodb - Fixed samples - Fixed grammar and typos - Fixed punctuation - Added and/or fixed links --- .../src/main/docs/debezium-mongodb-component.adoc | 42 +++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/components/camel-debezium/camel-debezium-mongodb/src/main/docs/debezium-mongodb-component.adoc b/components/camel-debezium/camel-debezium-mongodb/src/main/docs/debezium-mongodb-component.adoc index 967f27c5135..d89b1f08379 100644 --- a/components/camel-debezium/camel-debezium-mongodb/src/main/docs/debezium-mongodb-component.adoc +++ b/components/camel-debezium/camel-debezium-mongodb/src/main/docs/debezium-mongodb-component.adoc @@ -17,13 +17,25 @@ The Debezium MongoDB component is wrapper around https://debezium.io/[Debezium] using https://debezium.io/documentation/reference/1.9/development/engine.html[Debezium Engine], which enables Change Data Capture from MongoDB database using Debezium without the need for Kafka or Kafka Connect. -*Note:* The Debezium MongoDB connector uses MongoDB’s oplog to capture the changes, so the connector works only with MongoDB replica sets or with sharded clusters where each shard is a separate replica set, therefore you will need to have your MongoDB instance running either in replica set mode -or sharded clusters mode. - -*Note on handling failures:* Per https://debezium.io/documentation/reference/1.9/development/engine.html#_handling_failures[Debezium Embedded Engine] documentation, the engines is actively recording source offsets and periodically flushes these offsets to a persistent storage, so when the application is restarted or crashed, the engine will resume from the last recorded offset. -Thus, at normal operation, your downstream routes will receive each event exactly once, however in case of an application crash (not having a graceful shutdown), the application will resume from the last recorded offset, -which may result in receiving duplicate events immediately after the restart. Therefore, your downstream routes should be tolerant enough of such case and deduplicate events if needed. - +[NOTE] +==== +The Debezium MongoDB connector uses MongoDB’s oplog to capture the changes. +The connector works only with the MongoDB replica sets or with sharded clusters, where each shard is a separate replica set. +Therefore, you will need to have your MongoDB instance running either in replica set mode or sharded clusters mode. +==== + +[NOTE] +==== +*Note on handling failures:* +per https://debezium.io/documentation/reference/1.9/development/engine.html#_handling_failures[Debezium Embedded Engine] documentation, +the engines are actively recording source offsets and periodically flush these offsets to a persistent storage. +Therefore, when the application is restarted or crashed, the engine will resume from the last recorded offset. +This means that, at normal operation, your downstream routes will receive each event exactly once. +However, in case of an application crash (not having a graceful shutdown), +the application will resume from the last recorded offset, +which may result in receiving duplicate events immediately after the restart. +Therefore, your downstream routes should be tolerant enough of such a case and deduplicate events if needed. +==== Maven users will need to add the following dependency to their `pom.xml` for this component. @@ -68,13 +80,13 @@ include::partial$component-endpoint-headers.adoc[] *Note*: Debezium Mongodb uses MongoDB’s oplog to populate the CDC events, the update events in MongoDB’s oplog don’t have the before or after states of the changed document, so there’s no way for the Debezium connector to provide this information, therefore header key `CamelDebeziumBefore` is not available in this component. == Message body -The message body if is not `null` (in case of tombstones), it contains the state of the row after the event occurred as `String` JSON format and you can unmarchal using Camel JSON Data Format. +The message body if is not `null` (in case of tombstones), it contains the state of the row after the event occurred as `String` JSON format, and you can unmarshal using Camel JSON Data Format. == Samples === Consuming events -Here is a very simple route that you can use in order to listen to Debezium events from MongoDB connector. +Here is a basic route that you can use to listen to Debezium events from MongoDB connector: [source,java] ---- @@ -93,9 +105,15 @@ from("debezium-mongodb:dbz-test-1?offsetStorageFileName=/usr/offset-file-1.dat&m .end(); ---- -By default, the component will emit the events in the body String JSON format in case of `u`, `c` or `r` operations, this can be easily converted to JSON using Camel JSON Data Format e.g: `.unmarshal().json()` like the above example. In case of operation `d`, the body will be `null`. - -*Important Note:* This component is a thin wrapper around Debezium Engine as mentioned, therefore before using this component in production, you need to understand how Debezium works and how configurations can reflect the expected behavior, especially in regards to https://debezium.io/documentation/reference/1.9/development/engine.html#_handling_failures[handling failures]. +By default, the component will emit the events in the body String JSON format in case of `u`, `c` or `r` operations. +This can be easily converted to JSON using Camel JSON Data Format e.g.: `.unmarshal().json()` like the above example. +In case of operation `d`, the body will be `null`. +[IMPORTANT] +==== +This component is a thin wrapper around Debezium Engine as mentioned. +Therefore, before using this component in production, you need to understand how Debezium works and how configurations can reflect the expected behavior. +This is especially true in regard to https://debezium.io/documentation/reference/1.8/operations/embedded.html#_handling_failures[handling failures]. +==== include::spring-boot:partial$starter.adoc[]