This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 825531b CAMEL-14091: Add camel-debezium-postgres component (#3298) 825531b is described below commit 825531b3c7eb3defb5ddb8b5c80bc2ebf864ccec Author: Omar Al-Safi <omars...@gmail.com> AuthorDate: Thu Oct 31 05:07:23 2019 +0100 CAMEL-14091: Add camel-debezium-postgres component (#3298) * CAMEL-14091: Add camel-debezium-postgres first files * CAMEL-14091: Add tests Signed-off-by: Omar Al-Safi <omars...@gmail.com> --- apache-camel/pom.xml | 10 + apache-camel/src/main/descriptors/common-bin.xml | 2 + bom/camel-bom/pom.xml | 10 + components/camel-debezium-postgres/pom.xml | 149 ++++ .../src/main/docs/debezium-postgres-component.adoc | 282 +++++++ .../debezium/DebeziumPostgresComponent.java | 58 ++ .../debezium/DebeziumPostgresEndpoint.java | 50 ++ .../debezium/DebeziumPostgresComponentTest.java | 120 +++ ...ConnectorEmbeddedDebeziumConfigurationTest.java | 89 +++ .../src/test/resources/log4j2.properties | 30 + components/pom.xml | 1 + parent/pom.xml | 10 + .../karaf/features/src/main/resources/features.xml | 10 + .../camel-debezium-postgres-starter/pom.xml | 53 ++ ...DebeziumPostgresComponentAutoConfiguration.java | 129 ++++ .../DebeziumPostgresComponentConfiguration.java | 837 +++++++++++++++++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 +++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../src/main/resources/META-INF/spring.factories | 19 + .../src/main/resources/META-INF/spring.provides | 17 + platforms/spring-boot/components-starter/pom.xml | 1 + .../camel-spring-boot-dependencies/pom.xml | 10 + .../itest/karaf/CamelDebeziumPostgresTest.java | 35 + .../springboot/CamelDebeziumPostgresTest.java | 46 ++ 24 files changed, 2182 insertions(+) diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index d9f6e18..aab587b 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -478,6 +478,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-digitalocean</artifactId> <version>${project.version}</version> </dependency> @@ -2047,6 +2052,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres-starter</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-digitalocean-starter</artifactId> <version>${project.version}</version> </dependency> diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index 224d49e..74b2a9c 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -116,6 +116,7 @@ <include>org.apache.camel:camel-dataset</include> <include>org.apache.camel:camel-debezium-common</include> <include>org.apache.camel:camel-debezium-mysql</include> + <include>org.apache.camel:camel-debezium-postgres</include> <include>org.apache.camel:camel-digitalocean</include> <include>org.apache.camel:camel-direct</include> <include>org.apache.camel:camel-directvm</include> @@ -469,6 +470,7 @@ <include>org.apache.camel:camel-dataset-starter</include> <include>org.apache.camel:camel-debezium-common-starter</include> <include>org.apache.camel:camel-debezium-mysql-starter</include> + <include>org.apache.camel:camel-debezium-postgres-starter</include> <include>org.apache.camel:camel-digitalocean-starter</include> <include>org.apache.camel:camel-direct-starter</include> <include>org.apache.camel:camel-directvm-starter</include> diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 0aa6580..a2dc471 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -844,6 +844,16 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres-starter</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-digitalocean</artifactId> <version>${project.version}</version> </dependency> diff --git a/components/camel-debezium-postgres/pom.xml b/components/camel-debezium-postgres/pom.xml new file mode 100644 index 0000000..44934cd --- /dev/null +++ b/components/camel-debezium-postgres/pom.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>3.0.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-debezium-postgres</artifactId> + <packaging>jar</packaging> + <name>Camel :: Debezium :: PostgreSQL</name> + <description>Camel Debezium PostgreSQL support</description> + + <dependencies> + <!-- camel --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-common</artifactId> + </dependency> + + <!-- debezium PostgreSQL Connector --> + <dependency> + <groupId>io.debezium</groupId> + <artifactId>debezium-connector-postgres</artifactId> + <version>${debezium-version}</version> + </dependency> + + <!-- test --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-1.2-api</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.camel.maven</groupId> + <artifactId>camel-debezium-maven-plugin</artifactId> + <version>${project.version}</version> + <executions> + <execution> + <id>generate</id> + <goals> + <goal>generate-connector-config</goal> + </goals> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>io.debezium</groupId> + <artifactId>debezium-connector-postgres</artifactId> + <version>${debezium-version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + <configuration> + <connectorClassName>io.debezium.connector.postgresql.PostgresConnector</connectorClassName> + <connectorConfigClassName>io.debezium.connector.postgresql.PostgresConnectorConfig</connectorConfigClassName> + <fields> + <tombstones.on.delete>false</tombstones.on.delete> + </fields> + <requiredFields> + <field>database.password</field> + <field>database.server.name</field> + </requiredFields> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>add-generated-configurations-sources</id> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>${project.build.directory}/generated-sources/connector-configurations</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <!-- This used to copy EmbeddedDebeziumConfiguration source in order to generate the metadata via APT plugin--> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>src-dependencies</id> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <configuration> + <classifier>sources</classifier> + <includeArtifactIds>camel-debezium-common</includeArtifactIds> + <includes>**/*EmbeddedDebeziumConfiguration.java</includes> + <outputDirectory>${project.build.directory}/generated-sources/connector-configurations</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/components/camel-debezium-postgres/src/main/docs/debezium-postgres-component.adoc b/components/camel-debezium-postgres/src/main/docs/debezium-postgres-component.adoc new file mode 100644 index 0000000..0dbbf9f --- /dev/null +++ b/components/camel-debezium-postgres/src/main/docs/debezium-postgres-component.adoc @@ -0,0 +1,282 @@ +[[debezium-postgres-component]] += Debezium PostgresSQL Connector Component + +*Since Camel 3.0* + + +*Since Camel 3.0* + +The Debezium PostgresSQL component is wrapper around https://debezium.io/[Debezium] using https://debezium.io/documentation/reference/0.9/operations/embedded.html[Debezium Embedded], which enables Change Data Capture from PostgresSQL database using Debezium without the need for Kafka or Kafka Connect. + +*Note on handling failures:* Per https://debezium.io/documentation/reference/0.9/operations/embedded.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. + +Maven users will need to add the following dependency to their `pom.xml` +for this component. + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---- + +== URI format + +[source,text] +--------------------------- +debezium-postgres:name[?options] +--------------------------- + +== Options + + +// component options: START +The Debezium PostgresSQL Connector component supports 2 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *configuration* (consumer) | Allow pre-configured Configurations to be set. | | PostgresConnectorEmbeddedDebeziumConfiguration +| *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean +|=== +// component options: END + + +// endpoint options: START +The Debezium PostgresSQL Connector endpoint is configured using URI syntax: + +---- +debezium-postgres:name +---- + +with the following path and query parameters: + +=== Path Parameters (1 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *name* | *Required* Unique name for the connector. Attempting to register again with the same name will fail. | | String +|=== + + +=== Query Parameters (59 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean +| *internalKeyConverter* (consumer) | The Converter class that should be used to serialize and deserialize key data for offsets. The default is JSON converter. | org.apache.kafka.connect.json.JsonConverter | String +| *internalValueConverter* (consumer) | The Converter class that should be used to serialize and deserialize value data for offsets. The default is JSON converter. | org.apache.kafka.connect.json.JsonConverter | String +| *offsetCommitPolicy* (consumer) | The name of the Java class of the commit policy. It defines when offsets commit has to be triggered based on the number of events processed and the time elapsed since the last commit. This class must implement the interface .OffsetCommitPolicy. The default is a periodic commit policy based upon time intervals. | io.debezium.embedded.spi.OffsetCommitPolicy.PeriodicCommitOffsetPolicy | String +| *offsetCommitTimeoutMs* (consumer) | Maximum number of milliseconds to wait for records to flush and partition offset data to be committed to offset storage before cancelling the process and restoring the offset data to be committed in a future attempt. The default is 5 seconds. | 5000 | long +| *offsetFlushIntervalMs* (consumer) | Interval at which to try committing offsets. The default is 1 minute. | 60000 | long +| *offsetStorage* (consumer) | The name of the Java class that is responsible for persistence of connector offsets. | org.apache.kafka.connect.storage.FileOffsetBackingStore | String +| *offsetStorageFileName* (consumer) | Path to file where offsets are to be stored. Required when offset.storage is set to the FileOffsetBackingStore | | String +| *offsetStoragePartitions* (consumer) | The number of partitions used when creating the offset storage topic. Required when offset.storage is set to the .KafkaOffsetBackingStore. | | int +| *offsetStorageReplication Factor* (consumer) | Replication factor used when creating the offset storage topic. Required when offset.storage is set to the KafkaOffsetBackingStore | | int +| *offsetStorageTopic* (consumer) | The name of the Kafka topic where offsets are to be stored. Required when offset.storage is set to the KafkaOffsetBackingStore. | | String +| *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler +| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean +| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| *columnBlacklist* (postgres) | Description is not available here, please check Debezium website for corresponding key 'column.blacklist' description. | | String +| *databaseDbname* (postgres) | The name of the database the connector should be monitoring | | String +| *databaseHistoryFileFilename* (postgres) | The path to the file that will be used to record the database history | | String +| *databaseHostname* (postgres) | Resolvable hostname or IP address of the Postgres database server. | | String +| *databaseInitialStatements* (postgres) | A semicolon separated list of SQL statements to be executed when a JDBC connection to the database is established. Note that the connector may establish JDBC connections at its own discretion, so this should typically be used for configurationof session parameters only, but not for executing DML statements. Use doubled semicolon (';;') to use a semicolon as a character and not as a delimiter. | | String +| *databasePassword* (postgres) | *Required* Password of the Postgres database user to be used when connecting to the database. | | String +| *databasePort* (postgres) | Port of the Postgres database server. | 5432 | int +| *databaseServerName* (postgres) | *Required* Unique name that identifies the database server and all recorded offsets, and that is used as a prefix for all schemas and topics. Each distinct installation should have a separate namespace and be monitored by at most one Debezium connector. | | String +| *databaseSslcert* (postgres) | File containing the SSL Certificate for the client. See the Postgres SSL docs for further information | | String +| *databaseSslfactory* (postgres) | A name of class to that creates SSL Sockets. Use org.postgresql.ssl.NonValidatingFactory to disable SSL validation in development environments | | String +| *databaseSslkey* (postgres) | File containing the SSL private key for the client. See the Postgres SSL docs for further information | | String +| *databaseSslmode* (postgres) | Whether to use an encrypted connection to Postgres. Options include'disable' (the default) to use an unencrypted connection; 'require' to use a secure (encrypted) connection, and fail if one cannot be established; 'verify-ca' like 'required' but additionally verify the server TLS certificate against the configured Certificate Authority (CA) certificates, or fail if no valid matching CA certificates are found; or'verify-full' like 'verify-ca' but additiona [...] +| *databaseSslpassword* (postgres) | Password to access the client private key from the file specified by 'database.sslkey'. See the Postgres SSL docs for further information | | String +| *databaseSslrootcert* (postgres) | File containing the root certificate(s) against which the server is validated. See the Postgres JDBC SSL docs for further information | | String +| *databaseTcpkeepalive* (postgres) | Enable or disable TCP keep-alive probe to avoid dropping TCP connection | true | boolean +| *databaseUser* (postgres) | Name of the Postgres database user to be used when connecting to the database. | | String +| *decimalHandlingMode* (postgres) | Specify how DECIMAL and NUMERIC columns should be represented in change events, including:'precise' (the default) uses java.math.BigDecimal to represent values, which are encoded in the change events using a binary representation and Kafka Connect's 'org.apache.kafka.connect.data.Decimal' type; 'string' uses string to represent values; 'double' represents values using Java's 'double', which may not offer the precision but will be far easier to use in [...] +| *heartbeatIntervalMs* (postgres) | Length of an interval in milli-seconds in in which the connector periodically sends heartbeat messages to a heartbeat topic. Use 0 to disable heartbeat messages. Disabled by default. | 0 | int +| *heartbeatTopicsPrefix* (postgres) | The prefix that is used to name heartbeat topics.Defaults to __debezium-heartbeat. | __debezium-heartbeat | String +| *hstoreHandlingMode* (postgres) | Specify how HSTORE columns should be represented in change events, including:'json' represents values as json string'map' (default) represents values using java.util.Map | json | String +| *includeUnknownDatatypes* (postgres) | Specify whether the fields of data type not supported by Debezium should be processed:'false' (the default) omits the fields; 'true' converts the field into an implementation dependent binary representation. | false | boolean +| *maxBatchSize* (postgres) | Maximum size of each batch of source records. Defaults to 2048. | 2048 | int +| *maxQueueSize* (postgres) | Maximum size of the queue for change events read from the database log but not yet recorded or forwarded. Defaults to 8192, and should always be larger than the maximum batch size. | 8192 | int +| *pluginName* (postgres) | The name of the Postgres logical decoding plugin installed on the server. Supported values are 'decoderbufs' and 'wal2json'. Defaults to 'decoderbufs'. | decoderbufs | String +| *pollIntervalMs* (postgres) | Frequency in milliseconds to wait for new change events to appear after receiving no events. Defaults to 500ms. | 500 | long +| *schemaBlacklist* (postgres) | Description is not available here, please check Debezium website for corresponding key 'schema.blacklist' description. | | String +| *schemaRefreshMode* (postgres) | Specify the conditions that trigger a refresh of the in-memory schema for a table. 'columns_diff' (the default) is the safest mode, ensuring the in-memory schema stays in-sync with the database table's schema at all times. 'columns_diff_exclude_unchanged_toast' instructs the connector to refresh the in-memory schema cache if there is a discrepancy between it and the schema derived from the incoming message, unless unchanged TOASTable data fully accounts [...] +| *schemaWhitelist* (postgres) | The schemas for which events should be captured | | String +| *slotDrop_on_stop* (postgres) | Whether or not to drop the logical replication slot when the connector finishes orderlyBy default the replication is kept so that on restart progress can resume from the last recorded location | false | boolean +| *slotName* (postgres) | The name of the Postgres logical decoding slot created for streaming changes from a plugin.Defaults to 'debezium | debezium | String +| *slotStreamParams* (postgres) | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *snapshotCustomClass* (postgres) | When 'snapshot.mode' is set as custom, this setting must be set to specify a fully qualified class name to load (via the default class loader).This class must implement the 'Snapshotter' interface and is called on each app boot to determine whether to do a snapshot and how to build queries. | | String +| *snapshotDelayMs* (postgres) | The number of milliseconds to delay before a snapshot will begin. | 0 | long +| *snapshotFetchSize* (postgres) | The maximum number of records that should be loaded into memory while performing a snapshot | | int +| *snapshotLockTimeoutMs* (postgres) | The maximum number of millis to wait for table locks at the beginning of a snapshot. If locks cannot be acquired in this time frame, the snapshot will be aborted. Defaults to 10 seconds | 10000 | long +| *snapshotMode* (postgres) | The criteria for running a snapshot upon startup of the connector. Options include: 'always' to specify that the connector run a snapshot each time it starts up; 'initial' (the default) to specify the connector can run a snapshot only when no offsets are available for the logical server name; 'initial_only' same as 'initial' except the connector should stop after completing the snapshot and before it would normally start emitting changes;'never' to specify t [...] +| *snapshotSelectStatement Overrides* (postgres) | This property contains a comma-separated list of fully-qualified tables (DB_NAME.TABLE_NAME). Select statements for the individual tables are specified in further configuration properties, one for each table, identified by the id 'snapshot.select.statement.overrides.DB_NAME.TABLE_NAME'. The value of those properties is the select statement to use when retrieving data from the specific table during snapshotting. A possible use case for la [...] +| *statusUpdateIntervalMs* (postgres) | Frequency in milliseconds for sending replication connection status updates to the server. Defaults to 10 seconds (10000 ms). | 10000 | int +| *tableBlacklist* (postgres) | Description is not available here, please check Debezium website for corresponding key 'table.blacklist' description. | | String +| *tableWhitelist* (postgres) | The tables for which changes are to be captured | | String +| *timePrecisionMode* (postgres) | Time, date, and timestamps can be represented with different kinds of precisions, including:'adaptive' (the default) bases the precision of time, date, and timestamp values on the database column's precision; 'adaptive_time_microseconds' like 'adaptive' mode, but TIME fields always use microseconds precision;'connect' always represents time, date, and timestamp values using Kafka Connect's built-in representations for Time, Date, and Timestamp, which us [...] +| *tombstonesOnDelete* (postgres) | Whether delete operations should be represented by a delete event and a subsquenttombstone event (true) or only by a delete event (false). Emitting the tombstone event (the default behavior) allows Kafka to completely delete all events pertaining to the given key once the source record got deleted. | false | boolean +| *topicSelectionStrategy* (postgres) | How events received from the DB should be placed on topics. Options include'table' (the default) each DB table will have a separate Kafka topic; 'schema' there will be one Kafka topic per DB schema; events from multiple topics belonging to the same schema will be placed on the same topic | topic_per_table | String +| *xminFetchIntervalMs* (postgres) | Specify how often (in ms) the xmin will be fetched from the replication slot. This xmin value is exposed by the slot which gives a lower bound of where a new replication slot could start from. The lower the value, the more likely this value is to be the current 'true' value, but the bigger the performance cost. The bigger the value, the less likely this value is to be the current 'true' value, but the lower the performance penalty. The default is set [...] +|=== +// endpoint options: END +// spring-boot-auto-configure options: START +== Spring Boot Auto-Configuration + +When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres-starter</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---- + + +The component supports 57 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *camel.component.debezium-postgres.basic-property-binding* | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | Boolean +| *camel.component.debezium-postgres.configuration.column-blacklist* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.connector-class* | The name of the Java class for the connector | | Class +| *camel.component.debezium-postgres.configuration.database-dbname* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-history-file-filename* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-hostname* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-initial-statements* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-password* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-port* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 5432 | Integer +| *camel.component.debezium-postgres.configuration.database-server-name* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-sslcert* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-sslfactory* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-sslkey* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-sslmode* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | disable | String +| *camel.component.debezium-postgres.configuration.database-sslpassword* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-sslrootcert* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.database-tcpkeepalive* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | true | Boolean +| *camel.component.debezium-postgres.configuration.database-user* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.decimal-handling-mode* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | precise | String +| *camel.component.debezium-postgres.configuration.heartbeat-interval-ms* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 0 | Integer +| *camel.component.debezium-postgres.configuration.heartbeat-topics-prefix* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | __debezium-heartbeat | String +| *camel.component.debezium-postgres.configuration.hstore-handling-mode* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | json | String +| *camel.component.debezium-postgres.configuration.include-unknown-datatypes* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | false | Boolean +| *camel.component.debezium-postgres.configuration.internal-key-converter* | The Converter class that should be used to serialize and deserialize key data for offsets. The default is JSON converter. | org.apache.kafka.connect.json.JsonConverter | String +| *camel.component.debezium-postgres.configuration.internal-value-converter* | The Converter class that should be used to serialize and deserialize value data for offsets. The default is JSON converter. | org.apache.kafka.connect.json.JsonConverter | String +| *camel.component.debezium-postgres.configuration.max-batch-size* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 2048 | Integer +| *camel.component.debezium-postgres.configuration.max-queue-size* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 8192 | Integer +| *camel.component.debezium-postgres.configuration.name* | Unique name for the connector. Attempting to register again with the same name will fail. | | String +| *camel.component.debezium-postgres.configuration.offset-commit-policy* | The name of the Java class of the commit policy. It defines when offsets commit has to be triggered based on the number of events processed and the time elapsed since the last commit. This class must implement the interface <������>.OffsetCommitPolicy. The default is a periodic commit policy based upon time intervals. | io.debezium.embedded.spi.OffsetCommitPolicy.PeriodicCommitOffsetPolicy | String +| *camel.component.debezium-postgres.configuration.offset-commit-timeout-ms* | Maximum number of milliseconds to wait for records to flush and partition offset data to be committed to offset storage before cancelling the process and restoring the offset data to be committed in a future attempt. The default is 5 seconds. | 5000 | Long +| *camel.component.debezium-postgres.configuration.offset-flush-interval-ms* | Interval at which to try committing offsets. The default is 1 minute. | 60000 | Long +| *camel.component.debezium-postgres.configuration.offset-storage* | The name of the Java class that is responsible for persistence of connector offsets. | org.apache.kafka.connect.storage.FileOffsetBackingStore | String +| *camel.component.debezium-postgres.configuration.offset-storage-file-name* | Path to file where offsets are to be stored. Required when offset.storage is set to the FileOffsetBackingStore | | String +| *camel.component.debezium-postgres.configuration.offset-storage-partitions* | The number of partitions used when creating the offset storage topic. Required when offset.storage is set to the <������>.KafkaOffsetBackingStore. | | Integer +| *camel.component.debezium-postgres.configuration.offset-storage-replication-factor* | Replication factor used when creating the offset storage topic. Required when offset.storage is set to the KafkaOffsetBackingStore | | Integer +| *camel.component.debezium-postgres.configuration.offset-storage-topic* | The name of the Kafka topic where offsets are to be stored. Required when offset.storage is set to the KafkaOffsetBackingStore. | | String +| *camel.component.debezium-postgres.configuration.plugin-name* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | decoderbufs | String +| *camel.component.debezium-postgres.configuration.poll-interval-ms* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 500 | Long +| *camel.component.debezium-postgres.configuration.schema-blacklist* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.schema-refresh-mode* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | columns_diff | String +| *camel.component.debezium-postgres.configuration.schema-whitelist* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.slot-name* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | debezium | String +| *camel.component.debezium-postgres.configuration.slot-stream-params* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.snapshot-custom-class* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.snapshot-delay-ms* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 0 | Long +| *camel.component.debezium-postgres.configuration.snapshot-fetch-size* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | Integer +| *camel.component.debezium-postgres.configuration.snapshot-lock-timeout-ms* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 10000 | Long +| *camel.component.debezium-postgres.configuration.snapshot-mode* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | initial | String +| *camel.component.debezium-postgres.configuration.snapshot-select-statement-overrides* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.status-update-interval-ms* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 10000 | Integer +| *camel.component.debezium-postgres.configuration.table-blacklist* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.table-whitelist* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | | String +| *camel.component.debezium-postgres.configuration.time-precision-mode* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | adaptive | String +| *camel.component.debezium-postgres.configuration.tombstones-on-delete* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | false | Boolean +| *camel.component.debezium-postgres.configuration.topic-selection-strategy* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | topic_per_table | String +| *camel.component.debezium-postgres.configuration.xmin-fetch-interval-ms* | Any optional parameters used by logical decoding plugin. Semi-colon separated. E.g. 'add-tables=public.table,public.table2;include-lsn=true' | 0 | Long +| *camel.component.debezium-postgres.enabled* | Whether to enable auto configuration of the debezium-postgres component. This is enabled by default. | | Boolean +|=== +// spring-boot-auto-configure options: END + +For more information about configuration: +https://debezium.io/documentation/reference/0.9/operations/embedded.html#engine-properties[https://debezium.io/documentation/reference/0.9/operations/embedded.html#engine-properties] +https://debezium.io/documentation/reference/0.9/connectors/postgresql.html#connector-properties[https://debezium.io/documentation/reference/0.9/connectors/postgresql.html#connector-properties] + +== Message headers + +=== Consumer headers + +The following headers are available when consuming change events from Debezium. +[width="100%",cols="2m,2m,1m,5",options="header"] +|=== +| Header constant | Header value | Type | Description +| DebeziumConstants.HEADER_IDENTIFIER | "CamelDebeziumIdentifier" | String | The identifier of the connector, normally is this format "{server-name}.{database-name}.{table-name}". +| DebeziumConstants.HEADER_KEY | "CamelDebeziumKey" | Struct | The key of the event, normally is the table Primary Key. +| DebeziumConstants.HEADER_SOURCE_METADATA | "CamelDebeziumSourceMetadata" | Map | The metadata about the source event, for example `table` name, database `name`, log position, etc, please refer to the Debezium documentation for more info. +| DebeziumConstants.HEADER_OPERATION | "CamelDebeziumOperation" | String | If presents, the type of event operation. Values for the connector are `c` for create (or insert), `u` for update, `d` for delete or `r` in case of a snapshot event. +| DebeziumConstants.HEADER_TIMESTAMP | "CamelDebeziumTimestamp" | Long | If presents, the time (using the system clock in the JVM) at which the connector processed the event. +| DebeziumConstants.HEADER_BEFORE | "CamelDebeziumBefore" | Struct | If presents, contains the state of the row before the event occurred. +|=== + +== 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 `Struct` format or `Map` format if you use the included Type Converter from `Struct` to `Map` (please look below for more explanation). + +== Samples + +=== Consuming events + +Here is a very simple route that you can use in order to listen to Debezium events from PostgresSQL connector. +[source,java] +---- +from("debezium-postgres:dbz-test-1?offsetStorageFileName=/usr/offset-file-1.dat&databaseHostName=localhost&databaseUser=debezium&databasePassword=dbz&databaseServerName=my-app-connector&databaseHistoryFileName=/usr/history-file-1.dat") + .log("Event received from Debezium : ${body}") + .log(" with this identifier ${headers.CamelDebeziumIdentifier}") + .log(" with these source metadata ${headers.CamelDebeziumSourceMetadata}") + .log(" the event occured upon this operation '${headers.CamelDebeziumSourceOperation}'") + .log(" on this database '${headers.CamelDebeziumSourceMetadata[db]}' and this table '${headers.CamelDebeziumSourceMetadata[table]}'") + .log(" with the key ${headers.CamelDebeziumKey}") + .log(" the previous value is ${headers.CamelDebeziumBefore}") +---- + +By default, the component will emit the events in the body and `CamelDebeziumBefore` header as https://kafka.apache.org/22/javadoc/org/apache/kafka/connect/data/Struct.html[`Struct`] data type, the reasoning behind this, is to perceive the schema information in case is needed. +However, the component as well contains a xref:manual::type-converter.adoc[Type Converter] that converts +from default output type of https://kafka.apache.org/22/javadoc/org/apache/kafka/connect/data/Struct.html[`Struct`] to `Map` in order to leverage Camel's rich xref:manual::data-format.adoc[Data Format] types which many of them work out of box with `Map` data type. +To use it, you can either add `Map.class` type when you access the message e.g: `exchange.getIn().getBody(Map.class)`, or you can convert the body always to `Map` from the route builder by adding `.convertBodyTo(Map.class)` to your Camel Route DSL after `from` statement. + +We mentioned above about the schema, which can be used in case you need to perform advance data transformation and the schema is needed for that. If you choose not to convert your body to `Map`, +you can obtain the schema information as https://kafka.apache.org/22/javadoc/org/apache/kafka/connect/data/Schema.html[`Schema`] type from `Struct` like this: +[source,java] +---- +from("debezium-postgres:[name]?[options]]) + .process(exchange -> { + final Struct bodyValue = exchange.getIn().getBody(Struct.class); + final Schema schemaValue = bodyValue.schema(); + + log.info("Body value is :" + bodyValue); + log.info("With Schema : " + schemaValue); + log.info("And fields of :" + schemaValue.fields()); + log.info("Field name has `" + schemaValue.field("name").schema() + "` type"); + }); +---- + +*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/0.9/operations/embedded.html#_handling_failures[handling failures]. diff --git a/components/camel-debezium-postgres/src/main/java/org/apache/camel/component/debezium/DebeziumPostgresComponent.java b/components/camel-debezium-postgres/src/main/java/org/apache/camel/component/debezium/DebeziumPostgresComponent.java new file mode 100644 index 0000000..7a79022 --- /dev/null +++ b/components/camel-debezium-postgres/src/main/java/org/apache/camel/component/debezium/DebeziumPostgresComponent.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.debezium; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.debezium.configuration.PostgresConnectorEmbeddedDebeziumConfiguration; +import org.apache.camel.spi.annotations.Component; + +@Component("debezium-postgres") +public final class DebeziumPostgresComponent extends DebeziumComponent<PostgresConnectorEmbeddedDebeziumConfiguration> { + + private PostgresConnectorEmbeddedDebeziumConfiguration configuration; + + public DebeziumPostgresComponent() { + super(); + } + + public DebeziumPostgresComponent(final CamelContext context) { + super(context); + } + + /** + * Allow pre-configured Configurations to be set. + * + * @return {@link PostgresConnectorEmbeddedDebeziumConfiguration} + */ + @Override + public PostgresConnectorEmbeddedDebeziumConfiguration getConfiguration() { + if (configuration == null) { + return new PostgresConnectorEmbeddedDebeziumConfiguration(); + } + return configuration; + } + + @Override + public void setConfiguration(PostgresConnectorEmbeddedDebeziumConfiguration configuration) { + this.configuration = configuration; + } + + @Override + protected DebeziumEndpoint initializeDebeziumEndpoint(String uri, PostgresConnectorEmbeddedDebeziumConfiguration configuration) { + return new DebeziumPostgresEndpoint(uri, this, configuration); + } +} diff --git a/components/camel-debezium-postgres/src/main/java/org/apache/camel/component/debezium/DebeziumPostgresEndpoint.java b/components/camel-debezium-postgres/src/main/java/org/apache/camel/component/debezium/DebeziumPostgresEndpoint.java new file mode 100644 index 0000000..77c0d47 --- /dev/null +++ b/components/camel-debezium-postgres/src/main/java/org/apache/camel/component/debezium/DebeziumPostgresEndpoint.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.debezium; + +import org.apache.camel.component.debezium.configuration.PostgresConnectorEmbeddedDebeziumConfiguration; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; + +/** + * Represents a Debezium PostgresSQL endpoint which is used to capture changes in PostgresSQL database so that that applications can see those changes and respond to them. + */ +@UriEndpoint(firstVersion = "3.0.0", scheme = "debezium-postgres", title = "Debezium PostgresSQL Connector", syntax = "debezium-postgres:name", label = "database,sql,postgres", consumerOnly = true) +public final class DebeziumPostgresEndpoint extends DebeziumEndpoint<PostgresConnectorEmbeddedDebeziumConfiguration> { + + @UriParam + private PostgresConnectorEmbeddedDebeziumConfiguration configuration; + + public DebeziumPostgresEndpoint(final String uri, final DebeziumPostgresComponent component, final PostgresConnectorEmbeddedDebeziumConfiguration configuration) { + super(uri, component); + this.configuration = configuration; + } + + public DebeziumPostgresEndpoint() { + super(); + } + + @Override + public PostgresConnectorEmbeddedDebeziumConfiguration getConfiguration() { + return configuration; + } + + @Override + public void setConfiguration(final PostgresConnectorEmbeddedDebeziumConfiguration configuration) { + this.configuration = configuration; + } +} diff --git a/components/camel-debezium-postgres/src/test/java/org/apache/camel/component/debezium/DebeziumPostgresComponentTest.java b/components/camel-debezium-postgres/src/test/java/org/apache/camel/component/debezium/DebeziumPostgresComponentTest.java new file mode 100644 index 0000000..b68c490 --- /dev/null +++ b/components/camel-debezium-postgres/src/test/java/org/apache/camel/component/debezium/DebeziumPostgresComponentTest.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.debezium; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.component.debezium.configuration.PostgresConnectorEmbeddedDebeziumConfiguration; +import org.apache.camel.impl.DefaultCamelContext; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class DebeziumPostgresComponentTest { + + @Test + public void testIfConnectorEndpointCreatedWithConfig() throws Exception { + final Map<String, Object> params = new HashMap<>(); + params.put("offsetStorageFileName", "/offset_test_file"); + params.put("databaseHostname", "localhost"); + params.put("databaseUser", "dbz"); + params.put("databasePassword", "pwd"); + params.put("databaseServerName", "test"); + params.put("databaseServerId", 1234); + params.put("databaseHistoryFileFilename", "/db_history_file_test"); + + final String remaining = "test_name"; + final String uri = "debezium?name=test_name&offsetStorageFileName=/test&" + + "databaseHostName=localhost&databaseServerId=1234&databaseUser=dbz&databasePassword=pwd&" + + "databaseServerName=test&databaseHistoryFileName=/test"; + + final DebeziumComponent debeziumComponent = new DebeziumPostgresComponent(new DefaultCamelContext()); + final DebeziumEndpoint debeziumEndpoint = debeziumComponent.createEndpoint(uri, remaining, params); + + assertNotNull(debeziumEndpoint); + + // test for config + final PostgresConnectorEmbeddedDebeziumConfiguration configuration = (PostgresConnectorEmbeddedDebeziumConfiguration)debeziumEndpoint + .getConfiguration(); + assertEquals("test_name", configuration.getName()); + assertEquals("/offset_test_file", configuration.getOffsetStorageFileName()); + assertEquals("localhost", configuration.getDatabaseHostname()); + assertEquals("dbz", configuration.getDatabaseUser()); + assertEquals("pwd", configuration.getDatabasePassword()); + assertEquals("test", configuration.getDatabaseServerName()); + assertEquals("/db_history_file_test", configuration.getDatabaseHistoryFileFilename()); + } + + @Test + public void testIfCreatesComponentWithExternalConfiguration() throws Exception { + final PostgresConnectorEmbeddedDebeziumConfiguration configuration = new PostgresConnectorEmbeddedDebeziumConfiguration(); + configuration.setName("test_config"); + configuration.setDatabaseUser("test_db"); + configuration.setDatabasePassword("pwd"); + configuration.setOffsetStorageFileName("/offset/file"); + configuration.setDatabaseServerName("test"); + + final String uri = "debezium:dummy"; + final DebeziumComponent debeziumComponent = new DebeziumPostgresComponent(new DefaultCamelContext()); + + // set configurations + debeziumComponent.setConfiguration(configuration); + + final DebeziumEndpoint debeziumEndpoint = debeziumComponent.createEndpoint(uri, null, + Collections.emptyMap()); + + assertNotNull(debeziumEndpoint); + + // assert configurations + final PostgresConnectorEmbeddedDebeziumConfiguration actualConfigurations = (PostgresConnectorEmbeddedDebeziumConfiguration)debeziumEndpoint + .getConfiguration(); + assertNotNull(actualConfigurations); + assertEquals(configuration.getName(), actualConfigurations.getName()); + assertEquals(configuration.getDatabaseUser(), + actualConfigurations.getDatabaseUser()); + assertEquals(configuration.getConnectorClass(), actualConfigurations.getConnectorClass()); + } + + @Test(expected = IllegalArgumentException.class) + public void testIfItHandlesNullExternalConfigurations() throws Exception { + final String remaining = ""; + final String uri = "debezium:"; + final DebeziumComponent debeziumComponent = new DebeziumPostgresComponent(new DefaultCamelContext()); + + // set configurations + debeziumComponent.setConfiguration(null); + + final DebeziumEndpoint debeziumEndpoint = debeziumComponent.createEndpoint(uri, remaining, + Collections.emptyMap()); + } + + @Test(expected = IllegalArgumentException.class) + public void testIfItHandlesNullExternalConfigurationsWithValidUri() throws Exception { + final String remaining = "dummy"; + final String uri = "debezium:dummy"; + final DebeziumComponent debeziumComponent = new DebeziumPostgresComponent(new DefaultCamelContext()); + + // set configurations + debeziumComponent.setConfiguration(null); + + final DebeziumEndpoint debeziumEndpoint = debeziumComponent.createEndpoint(uri, remaining, + Collections.emptyMap()); + } +} \ No newline at end of file diff --git a/components/camel-debezium-postgres/src/test/java/org/apache/camel/component/debezium/configuration/PostgresConnectorEmbeddedDebeziumConfigurationTest.java b/components/camel-debezium-postgres/src/test/java/org/apache/camel/component/debezium/configuration/PostgresConnectorEmbeddedDebeziumConfigurationTest.java new file mode 100644 index 0000000..35b2ba8 --- /dev/null +++ b/components/camel-debezium-postgres/src/test/java/org/apache/camel/component/debezium/configuration/PostgresConnectorEmbeddedDebeziumConfigurationTest.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.debezium.configuration; + +import io.debezium.config.CommonConnectorConfig; +import io.debezium.config.Configuration; +import io.debezium.connector.postgresql.PostgresConnector; +import io.debezium.connector.postgresql.PostgresConnectorConfig; +import io.debezium.embedded.EmbeddedEngine; +import org.apache.camel.component.debezium.DebeziumConstants; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class PostgresConnectorEmbeddedDebeziumConfigurationTest { + + @Test + public void testIfCreatesConfig() { + final PostgresConnectorEmbeddedDebeziumConfiguration configuration = new PostgresConnectorEmbeddedDebeziumConfiguration(); + configuration.setName("test_config"); + configuration.setDatabaseUser("test_user"); + configuration.setMaxQueueSize(1212); + + final Configuration dbzConfigurations = configuration.createDebeziumConfiguration(); + + assertEquals("test_config", dbzConfigurations.getString(EmbeddedEngine.ENGINE_NAME)); + assertEquals("test_user", dbzConfigurations.getString(PostgresConnectorConfig.USER)); + assertEquals(1212, dbzConfigurations.getInteger(CommonConnectorConfig.MAX_QUEUE_SIZE)); + assertEquals(PostgresConnector.class.getName(), dbzConfigurations.getString(EmbeddedEngine.CONNECTOR_CLASS)); + assertEquals(DebeziumConstants.DEFAULT_OFFSET_STORAGE, + dbzConfigurations.getString(EmbeddedEngine.OFFSET_STORAGE)); + } + + @Test + public void testIfValidatesConfigurationCorrectly() { + final PostgresConnectorEmbeddedDebeziumConfiguration configuration = new PostgresConnectorEmbeddedDebeziumConfiguration(); + + configuration.setName("test_config"); + configuration.setDatabaseUser("test_db"); + configuration.setDatabaseServerName("test_server"); + configuration.setOffsetStorageFileName("/offset/file"); + configuration.setDatabaseHistoryFileFilename("/database_history/file"); + + assertFalse(configuration.validateConfiguration().isValid()); + + configuration.setDatabaseHostname("localhost"); + configuration.setDatabasePassword("test_pwd"); + + assertTrue(configuration.validateConfiguration().isValid()); + } + + @Test + public void testValidateConfigurationsForAllRequiredFields() { + final PostgresConnectorEmbeddedDebeziumConfiguration configuration = new PostgresConnectorEmbeddedDebeziumConfiguration(); + configuration.setName("test_config"); + configuration.setDatabaseUser("test_db"); + configuration.setDatabaseHostname("localhost"); + configuration.setDatabasePassword("test_pwd"); + configuration.setDatabaseServerName("test_server"); + configuration.setOffsetStorageFileName("/offset/file"); + configuration.setDatabaseHistoryFileFilename("/database_history/file"); + + final ConfigurationValidation validation = configuration.validateConfiguration(); + assertTrue(validation.isValid()); + + assertEquals("test_config", configuration.getName()); + assertEquals("test_db", configuration.getDatabaseUser()); + assertEquals("localhost", configuration.getDatabaseHostname()); + assertEquals("test_pwd", configuration.getDatabasePassword()); + assertEquals("test_server", configuration.getDatabaseServerName()); + assertEquals("/offset/file", configuration.getOffsetStorageFileName()); + assertEquals("/database_history/file", configuration.getDatabaseHistoryFileFilename()); + } + +} \ No newline at end of file diff --git a/components/camel-debezium-postgres/src/test/resources/log4j2.properties b/components/camel-debezium-postgres/src/test/resources/log4j2.properties new file mode 100644 index 0000000..a3dd382 --- /dev/null +++ b/components/camel-debezium-postgres/src/test/resources/log4j2.properties @@ -0,0 +1,30 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-debezium-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n + +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n + +rootLogger.level = INFO +rootLogger.appenderRef.file.ref = file \ No newline at end of file diff --git a/components/pom.xml b/components/pom.xml index 0f5ba52..098d1b7 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -159,6 +159,7 @@ <module>camel-dropbox</module> <module>camel-debezium-common</module> <module>camel-debezium-mysql</module> + <module>camel-debezium-postgres</module> <module>camel-ehcache</module> <module>camel-elasticsearch-rest</module> <module>camel-elsql</module> diff --git a/parent/pom.xml b/parent/pom.xml index 004d27a..60b7908 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -1199,6 +1199,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-digitalocean</artifactId> <version>${project.version}</version> </dependency> @@ -2808,6 +2813,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres-starter</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-digitalocean-starter</artifactId> <version>${project.version}</version> </dependency> diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index a071a04..ab27da9 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -898,6 +898,16 @@ <bundle>mvn:org.apache.camel/camel-debezium-common/${project.version}</bundle> <bundle>mvn:org.apache.camel/camel-debezium-mysql/${project.version}</bundle> </feature> + <feature name='camel-debezium-postgres' version='${project.version}' start-level='50'> + <feature version="${project.version}">camel-core</feature> + <bundle dependency="true">wrap:mvn:io.debezium/debezium-core/${debezium-version}</bundle> + <bundle dependency="true">wrap:mvn:io.debezium/debezium-embedded/${debezium-version}</bundle> + <bundle dependency="true">wrap:mvn:io.debezium/debezium-connector-postgres/${debezium-version}</bundle> + <bundle dependency="true">wrap:mvn:org.apache.kafka/connect-api/${kafka-version}</bundle> + <bundle dependency="true">wrap:mvn:org.apache.kafka/connect-json/${kafka-version}</bundle> + <bundle>mvn:org.apache.camel/camel-debezium-common/${project.version}</bundle> + <bundle>mvn:org.apache.camel/camel-debezium-postgres/${project.version}</bundle> + </feature> <feature name='camel-ehcache' version='${project.version}' start-level='50'> <feature>scr</feature> <feature version="${project.version}">camel-core</feature> diff --git a/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/pom.xml b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/pom.xml new file mode 100644 index 0000000..d062d3f --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/pom.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components-starter</artifactId> + <version>3.0.0-SNAPSHOT</version> + </parent> + <artifactId>camel-debezium-postgres-starter</artifactId> + <packaging>jar</packaging> + <name>Spring-Boot Starter :: Camel :: Debezium :: PostgreSQL</name> + <description>Spring-Boot Starter for Camel Debezium PostgreSQL support</description> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>${spring-boot-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres</artifactId> + <version>${project.version}</version> + </dependency> + <!--START OF GENERATED CODE--> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-boot-starter</artifactId> + </dependency> + <!--END OF GENERATED CODE--> + </dependencies> +</project> diff --git a/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/java/org/apache/camel/component/debezium/springboot/DebeziumPostgresComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/java/org/apache/camel/component/debezium/springboot/DebeziumPostgresComponentAutoConfiguration.java new file mode 100644 index 0000000..6ab0a93 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/java/org/apache/camel/component/debezium/springboot/DebeziumPostgresComponentAutoConfiguration.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.debezium.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.debezium.DebeziumPostgresComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + DebeziumPostgresComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + DebeziumPostgresComponentConfiguration.class}) +public class DebeziumPostgresComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(DebeziumPostgresComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private DebeziumPostgresComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<DebeziumPostgresComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", "camel.component.debezium-postgres"); + } + } + + @Lazy + @Bean(name = "debezium-postgres-component") + @ConditionalOnMissingBean(DebeziumPostgresComponent.class) + public DebeziumPostgresComponent configureDebeziumPostgresComponent() + throws Exception { + DebeziumPostgresComponent component = new DebeziumPostgresComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + CamelPropertiesHelper.setCamelProperties(camelContext, + nestedProperty, nestedParameters, false); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + CamelPropertiesHelper.setCamelProperties(camelContext, component, + parameters, false); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<DebeziumPostgresComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.debezium-postgres.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.debezium-postgres.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/java/org/apache/camel/component/debezium/springboot/DebeziumPostgresComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/java/org/apache/camel/component/debezium/springboot/DebeziumPostgresComponentConfiguration.java new file mode 100644 index 0000000..8cda09c --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/java/org/apache/camel/component/debezium/springboot/DebeziumPostgresComponentConfiguration.java @@ -0,0 +1,837 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.debezium.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Represents a Debezium PostgresSQL endpoint which is used to capture changes + * in PostgresSQL database so that that applications can see those changes and + * respond to them. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.debezium-postgres") +public class DebeziumPostgresComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the debezium-postgres component. + * This is enabled by default. + */ + private Boolean enabled; + /** + * Allow pre-configured Configurations to be set. + */ + private PostgresConnectorEmbeddedDebeziumConfigurationNestedConfiguration configuration; + /** + * Whether the component should use basic property binding (Camel 2.x) or + * the newer property binding with additional capabilities + */ + private Boolean basicPropertyBinding = false; + + public PostgresConnectorEmbeddedDebeziumConfigurationNestedConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration( + PostgresConnectorEmbeddedDebeziumConfigurationNestedConfiguration configuration) { + this.configuration = configuration; + } + + public Boolean getBasicPropertyBinding() { + return basicPropertyBinding; + } + + public void setBasicPropertyBinding(Boolean basicPropertyBinding) { + this.basicPropertyBinding = basicPropertyBinding; + } + + public static class PostgresConnectorEmbeddedDebeziumConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.debezium.configuration.PostgresConnectorEmbeddedDebeziumConfiguration.class; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String snapshotCustomClass; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Integer maxQueueSize = 8192; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String slotName = "debezium"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String hstoreHandlingMode = "json"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String columnBlacklist; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Long snapshotDelayMs = 0L; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String schemaBlacklist; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String tableBlacklist; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String schemaRefreshMode = "columns_diff"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String tableWhitelist; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String topicSelectionStrategy = "topic_per_table"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Boolean tombstonesOnDelete = false; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseSslmode = "disable"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String decimalHandlingMode = "precise"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseSslcert; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Long pollIntervalMs = 500L; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseInitialStatements; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String heartbeatTopicsPrefix = "__debezium-heartbeat"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseSslfactory; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Integer statusUpdateIntervalMs = 10000; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Integer snapshotFetchSize; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Long snapshotLockTimeoutMs = 10000L; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Boolean databaseTcpkeepalive = true; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseHistoryFileFilename; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseDbname; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseUser; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseSslkey; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String snapshotSelectStatementOverrides; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Long xminFetchIntervalMs = 0L; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String timePrecisionMode = "adaptive"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseServerName; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Integer heartbeatIntervalMs = 0; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String pluginName = "decoderbufs"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Integer databasePort = 5432; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseSslpassword; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String schemaWhitelist; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Boolean includeUnknownDatatypes = false; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseHostname; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databasePassword; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String databaseSslrootcert; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private Integer maxBatchSize = 2048; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String snapshotMode = "initial"; + /** + * Any optional parameters used by logical decoding plugin. Semi-colon + * separated. E.g. + * 'add-tables=public.table,public.table2;include-lsn=true' + */ + private String slotStreamParams; + /** + * The name of the Java class for the connector + */ + private Class connectorClass; + /** + * Unique name for the connector. Attempting to register again with the + * same name will fail. + */ + private String name; + /** + * The name of the Java class that is responsible for persistence of + * connector offsets. + */ + private String offsetStorage = "org.apache.kafka.connect.storage.FileOffsetBackingStore"; + /** + * Path to file where offsets are to be stored. Required when + * offset.storage is set to the FileOffsetBackingStore + */ + private String offsetStorageFileName; + /** + * The name of the Kafka topic where offsets are to be stored. Required + * when offset.storage is set to the KafkaOffsetBackingStore. + */ + private String offsetStorageTopic; + /** + * Replication factor used when creating the offset storage topic. + * Required when offset.storage is set to the KafkaOffsetBackingStore + */ + private Integer offsetStorageReplicationFactor; + /** + * The name of the Java class of the commit policy. It defines when + * offsets commit has to be triggered based on the number of events + * processed and the time elapsed since the last commit. This class must + * implement the interface <������>.OffsetCommitPolicy. The default is a + * periodic commit policy based upon time intervals. + */ + private String offsetCommitPolicy = "io.debezium.embedded.spi.OffsetCommitPolicy.PeriodicCommitOffsetPolicy"; + /** + * Interval at which to try committing offsets. The default is 1 minute. + */ + private Long offsetFlushIntervalMs = 60000L; + /** + * Maximum number of milliseconds to wait for records to flush and + * partition offset data to be committed to offset storage before + * cancelling the process and restoring the offset data to be committed + * in a future attempt. The default is 5 seconds. + */ + private Long offsetCommitTimeoutMs = 5000L; + /** + * The number of partitions used when creating the offset storage topic. + * Required when offset.storage is set to the + * <������>.KafkaOffsetBackingStore. + */ + private Integer offsetStoragePartitions; + /** + * The Converter class that should be used to serialize and deserialize + * key data for offsets. The default is JSON converter. + */ + private String internalKeyConverter = "org.apache.kafka.connect.json.JsonConverter"; + /** + * The Converter class that should be used to serialize and deserialize + * value data for offsets. The default is JSON converter. + */ + private String internalValueConverter = "org.apache.kafka.connect.json.JsonConverter"; + + public String getSnapshotCustomClass() { + return snapshotCustomClass; + } + + public void setSnapshotCustomClass(String snapshotCustomClass) { + this.snapshotCustomClass = snapshotCustomClass; + } + + public Integer getMaxQueueSize() { + return maxQueueSize; + } + + public void setMaxQueueSize(Integer maxQueueSize) { + this.maxQueueSize = maxQueueSize; + } + + public String getSlotName() { + return slotName; + } + + public void setSlotName(String slotName) { + this.slotName = slotName; + } + + public String getHstoreHandlingMode() { + return hstoreHandlingMode; + } + + public void setHstoreHandlingMode(String hstoreHandlingMode) { + this.hstoreHandlingMode = hstoreHandlingMode; + } + + public String getColumnBlacklist() { + return columnBlacklist; + } + + public void setColumnBlacklist(String columnBlacklist) { + this.columnBlacklist = columnBlacklist; + } + + public Long getSnapshotDelayMs() { + return snapshotDelayMs; + } + + public void setSnapshotDelayMs(Long snapshotDelayMs) { + this.snapshotDelayMs = snapshotDelayMs; + } + + public String getSchemaBlacklist() { + return schemaBlacklist; + } + + public void setSchemaBlacklist(String schemaBlacklist) { + this.schemaBlacklist = schemaBlacklist; + } + + public String getTableBlacklist() { + return tableBlacklist; + } + + public void setTableBlacklist(String tableBlacklist) { + this.tableBlacklist = tableBlacklist; + } + + public String getSchemaRefreshMode() { + return schemaRefreshMode; + } + + public void setSchemaRefreshMode(String schemaRefreshMode) { + this.schemaRefreshMode = schemaRefreshMode; + } + + public String getTableWhitelist() { + return tableWhitelist; + } + + public void setTableWhitelist(String tableWhitelist) { + this.tableWhitelist = tableWhitelist; + } + + public String getTopicSelectionStrategy() { + return topicSelectionStrategy; + } + + public void setTopicSelectionStrategy(String topicSelectionStrategy) { + this.topicSelectionStrategy = topicSelectionStrategy; + } + + public Boolean getTombstonesOnDelete() { + return tombstonesOnDelete; + } + + public void setTombstonesOnDelete(Boolean tombstonesOnDelete) { + this.tombstonesOnDelete = tombstonesOnDelete; + } + + public String getDatabaseSslmode() { + return databaseSslmode; + } + + public void setDatabaseSslmode(String databaseSslmode) { + this.databaseSslmode = databaseSslmode; + } + + public String getDecimalHandlingMode() { + return decimalHandlingMode; + } + + public void setDecimalHandlingMode(String decimalHandlingMode) { + this.decimalHandlingMode = decimalHandlingMode; + } + + public String getDatabaseSslcert() { + return databaseSslcert; + } + + public void setDatabaseSslcert(String databaseSslcert) { + this.databaseSslcert = databaseSslcert; + } + + public Long getPollIntervalMs() { + return pollIntervalMs; + } + + public void setPollIntervalMs(Long pollIntervalMs) { + this.pollIntervalMs = pollIntervalMs; + } + + public String getDatabaseInitialStatements() { + return databaseInitialStatements; + } + + public void setDatabaseInitialStatements( + String databaseInitialStatements) { + this.databaseInitialStatements = databaseInitialStatements; + } + + public String getHeartbeatTopicsPrefix() { + return heartbeatTopicsPrefix; + } + + public void setHeartbeatTopicsPrefix(String heartbeatTopicsPrefix) { + this.heartbeatTopicsPrefix = heartbeatTopicsPrefix; + } + + public String getDatabaseSslfactory() { + return databaseSslfactory; + } + + public void setDatabaseSslfactory(String databaseSslfactory) { + this.databaseSslfactory = databaseSslfactory; + } + + public Integer getStatusUpdateIntervalMs() { + return statusUpdateIntervalMs; + } + + public void setStatusUpdateIntervalMs(Integer statusUpdateIntervalMs) { + this.statusUpdateIntervalMs = statusUpdateIntervalMs; + } + + public Integer getSnapshotFetchSize() { + return snapshotFetchSize; + } + + public void setSnapshotFetchSize(Integer snapshotFetchSize) { + this.snapshotFetchSize = snapshotFetchSize; + } + + public Long getSnapshotLockTimeoutMs() { + return snapshotLockTimeoutMs; + } + + public void setSnapshotLockTimeoutMs(Long snapshotLockTimeoutMs) { + this.snapshotLockTimeoutMs = snapshotLockTimeoutMs; + } + + public Boolean getDatabaseTcpkeepalive() { + return databaseTcpkeepalive; + } + + public void setDatabaseTcpkeepalive(Boolean databaseTcpkeepalive) { + this.databaseTcpkeepalive = databaseTcpkeepalive; + } + + public String getDatabaseHistoryFileFilename() { + return databaseHistoryFileFilename; + } + + public void setDatabaseHistoryFileFilename( + String databaseHistoryFileFilename) { + this.databaseHistoryFileFilename = databaseHistoryFileFilename; + } + + public String getDatabaseDbname() { + return databaseDbname; + } + + public void setDatabaseDbname(String databaseDbname) { + this.databaseDbname = databaseDbname; + } + + public String getDatabaseUser() { + return databaseUser; + } + + public void setDatabaseUser(String databaseUser) { + this.databaseUser = databaseUser; + } + + public String getDatabaseSslkey() { + return databaseSslkey; + } + + public void setDatabaseSslkey(String databaseSslkey) { + this.databaseSslkey = databaseSslkey; + } + + public String getSnapshotSelectStatementOverrides() { + return snapshotSelectStatementOverrides; + } + + public void setSnapshotSelectStatementOverrides( + String snapshotSelectStatementOverrides) { + this.snapshotSelectStatementOverrides = snapshotSelectStatementOverrides; + } + + public Long getXminFetchIntervalMs() { + return xminFetchIntervalMs; + } + + public void setXminFetchIntervalMs(Long xminFetchIntervalMs) { + this.xminFetchIntervalMs = xminFetchIntervalMs; + } + + public String getTimePrecisionMode() { + return timePrecisionMode; + } + + public void setTimePrecisionMode(String timePrecisionMode) { + this.timePrecisionMode = timePrecisionMode; + } + + public String getDatabaseServerName() { + return databaseServerName; + } + + public void setDatabaseServerName(String databaseServerName) { + this.databaseServerName = databaseServerName; + } + + public Integer getHeartbeatIntervalMs() { + return heartbeatIntervalMs; + } + + public void setHeartbeatIntervalMs(Integer heartbeatIntervalMs) { + this.heartbeatIntervalMs = heartbeatIntervalMs; + } + + public String getPluginName() { + return pluginName; + } + + public void setPluginName(String pluginName) { + this.pluginName = pluginName; + } + + public Integer getDatabasePort() { + return databasePort; + } + + public void setDatabasePort(Integer databasePort) { + this.databasePort = databasePort; + } + + public String getDatabaseSslpassword() { + return databaseSslpassword; + } + + public void setDatabaseSslpassword(String databaseSslpassword) { + this.databaseSslpassword = databaseSslpassword; + } + + public String getSchemaWhitelist() { + return schemaWhitelist; + } + + public void setSchemaWhitelist(String schemaWhitelist) { + this.schemaWhitelist = schemaWhitelist; + } + + public Boolean getIncludeUnknownDatatypes() { + return includeUnknownDatatypes; + } + + public void setIncludeUnknownDatatypes(Boolean includeUnknownDatatypes) { + this.includeUnknownDatatypes = includeUnknownDatatypes; + } + + public String getDatabaseHostname() { + return databaseHostname; + } + + public void setDatabaseHostname(String databaseHostname) { + this.databaseHostname = databaseHostname; + } + + public String getDatabasePassword() { + return databasePassword; + } + + public void setDatabasePassword(String databasePassword) { + this.databasePassword = databasePassword; + } + + public String getDatabaseSslrootcert() { + return databaseSslrootcert; + } + + public void setDatabaseSslrootcert(String databaseSslrootcert) { + this.databaseSslrootcert = databaseSslrootcert; + } + + public Integer getMaxBatchSize() { + return maxBatchSize; + } + + public void setMaxBatchSize(Integer maxBatchSize) { + this.maxBatchSize = maxBatchSize; + } + + public String getSnapshotMode() { + return snapshotMode; + } + + public void setSnapshotMode(String snapshotMode) { + this.snapshotMode = snapshotMode; + } + + public String getSlotStreamParams() { + return slotStreamParams; + } + + public void setSlotStreamParams(String slotStreamParams) { + this.slotStreamParams = slotStreamParams; + } + + public Class getConnectorClass() { + return connectorClass; + } + + public void setConnectorClass(Class connectorClass) { + this.connectorClass = connectorClass; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getOffsetStorage() { + return offsetStorage; + } + + public void setOffsetStorage(String offsetStorage) { + this.offsetStorage = offsetStorage; + } + + public String getOffsetStorageFileName() { + return offsetStorageFileName; + } + + public void setOffsetStorageFileName(String offsetStorageFileName) { + this.offsetStorageFileName = offsetStorageFileName; + } + + public String getOffsetStorageTopic() { + return offsetStorageTopic; + } + + public void setOffsetStorageTopic(String offsetStorageTopic) { + this.offsetStorageTopic = offsetStorageTopic; + } + + public Integer getOffsetStorageReplicationFactor() { + return offsetStorageReplicationFactor; + } + + public void setOffsetStorageReplicationFactor( + Integer offsetStorageReplicationFactor) { + this.offsetStorageReplicationFactor = offsetStorageReplicationFactor; + } + + public String getOffsetCommitPolicy() { + return offsetCommitPolicy; + } + + public void setOffsetCommitPolicy(String offsetCommitPolicy) { + this.offsetCommitPolicy = offsetCommitPolicy; + } + + public Long getOffsetFlushIntervalMs() { + return offsetFlushIntervalMs; + } + + public void setOffsetFlushIntervalMs(Long offsetFlushIntervalMs) { + this.offsetFlushIntervalMs = offsetFlushIntervalMs; + } + + public Long getOffsetCommitTimeoutMs() { + return offsetCommitTimeoutMs; + } + + public void setOffsetCommitTimeoutMs(Long offsetCommitTimeoutMs) { + this.offsetCommitTimeoutMs = offsetCommitTimeoutMs; + } + + public Integer getOffsetStoragePartitions() { + return offsetStoragePartitions; + } + + public void setOffsetStoragePartitions(Integer offsetStoragePartitions) { + this.offsetStoragePartitions = offsetStoragePartitions; + } + + public String getInternalKeyConverter() { + return internalKeyConverter; + } + + public void setInternalKeyConverter(String internalKeyConverter) { + this.internalKeyConverter = internalKeyConverter; + } + + public String getInternalValueConverter() { + return internalValueConverter; + } + + public void setInternalValueConverter(String internalValueConverter) { + this.internalValueConverter = internalValueConverter; + } + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000..6b0b127 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 0000000..2e215bf --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..3a7c545 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,19 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.debezium.springboot.DebeziumPostgresComponentAutoConfiguration diff --git a/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/spring.provides new file mode 100644 index 0000000..502e874 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-debezium-postgres-starter/src/main/resources/META-INF/spring.provides @@ -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. +## --------------------------------------------------------------------------- +provides: camel-debezium-postgres diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml index e242a98..0825962 100644 --- a/platforms/spring-boot/components-starter/pom.xml +++ b/platforms/spring-boot/components-starter/pom.xml @@ -170,6 +170,7 @@ <module>camel-dataset-starter</module> <module>camel-debezium-common-starter</module> <module>camel-debezium-mysql-starter</module> + <module>camel-debezium-postgres-starter</module> <module>camel-digitalocean-starter</module> <module>camel-direct-starter</module> <module>camel-directvm-starter</module> diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml index 24952c3..ca0de40 100644 --- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml +++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml @@ -1069,6 +1069,16 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debezium-postgres-starter</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-debezium-parent</artifactId> <version>${project.version}</version> </dependency> diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelDebeziumPostgresTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelDebeziumPostgresTest.java new file mode 100644 index 0000000..0c689bb --- /dev/null +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelDebeziumPostgresTest.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.itest.karaf; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.junit.PaxExam; + +@Ignore +@RunWith(PaxExam.class) +public class CamelDebeziumPostgresTest extends BaseKarafTest { + + public static final String COMPONENT = extractName(CamelDebeziumPostgresTest.class); + + @Test + public void test() throws Exception { + testComponent(COMPONENT); + } + +} diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelDebeziumPostgresTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelDebeziumPostgresTest.java new file mode 100644 index 0000000..ef68b81 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelDebeziumPostgresTest.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelDebeziumPostgresTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelDebeziumPostgresTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config); + this.runModuleUnitTestsIfEnabled(config); + } +}