-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement Tombstone Message Handling
- Added support for handling tombstone messages in the JDBC sink connector. - Implemented the ability to delete rows based on tombstone messages. - Introduced a new parameter, `delete.enabled`, to control delete behavior. - Aligned functionality with the documented approach for processing tombstones, similar to Confluent JDBC driver behavior. Signed-off-by: Joel Hanson <joelhanson025@gmail.com>
- Loading branch information
1 parent
39babfb
commit d7e51af
Showing
11 changed files
with
843 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/integrationTest/java/io/aiven/kafka/connect/jdbc/oracle/AbstractOracleIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright 2024 Aiven Oy and jdbc-connector-for-apache-kafka project contributors | ||
* | ||
* 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. | ||
*/ | ||
|
||
package io.aiven.kafka.connect.jdbc.oracle; | ||
|
||
import javax.sql.DataSource; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import io.aiven.kafka.connect.jdbc.AbstractIT; | ||
|
||
import oracle.jdbc.pool.OracleDataSource; | ||
import org.testcontainers.junit.jupiter.Container; | ||
import org.testcontainers.oracle.OracleContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
public class AbstractOracleIT extends AbstractIT { | ||
|
||
public static final String DEFAULT_ORACLE_TAG = "slim-faststart"; | ||
private static final DockerImageName DEFAULT_ORACLE_IMAGE_NAME = | ||
DockerImageName.parse("gvenzl/oracle-free") | ||
.withTag(DEFAULT_ORACLE_TAG); | ||
@Container | ||
public static final OracleContainer ORACLE_CONTAINER = new OracleContainer(DEFAULT_ORACLE_IMAGE_NAME); | ||
|
||
protected void executeSqlStatement(final String sqlStatement) throws SQLException { | ||
try (final Connection connection = getDatasource().getConnection(); | ||
final Statement statement = connection.createStatement()) { | ||
statement.executeUpdate(sqlStatement); | ||
} | ||
} | ||
|
||
protected DataSource getDatasource() throws SQLException { | ||
final OracleDataSource dataSource = new OracleDataSource(); | ||
dataSource.setServerName(ORACLE_CONTAINER.getHost()); | ||
// Assuming the default Oracle port is 1521 | ||
dataSource.setPortNumber(ORACLE_CONTAINER.getMappedPort(1521)); | ||
// Or use setDatabaseName() if that's how your Oracle is configured | ||
dataSource.setServiceName(ORACLE_CONTAINER.getDatabaseName()); | ||
dataSource.setUser(ORACLE_CONTAINER.getUsername()); | ||
dataSource.setPassword(ORACLE_CONTAINER.getPassword()); | ||
dataSource.setDriverType("thin"); | ||
return dataSource; | ||
} | ||
|
||
|
||
protected Map<String, String> basicConnectorConfig() { | ||
final HashMap<String, String> config = new HashMap<>(); | ||
config.put("tasks.max", "1"); | ||
config.put("connection.url", ORACLE_CONTAINER.getJdbcUrl()); | ||
config.put("connection.user", ORACLE_CONTAINER.getUsername()); | ||
config.put("connection.password", ORACLE_CONTAINER.getPassword()); | ||
config.put("dialect.name", "OracleDatabaseDialect"); | ||
config.put("key.converter", "io.confluent.connect.avro.AvroConverter"); | ||
config.put("key.converter.schema.registry.url", schemaRegistryContainer.getSchemaRegistryUrl()); | ||
config.put("value.converter", "io.confluent.connect.avro.AvroConverter"); | ||
config.put("value.converter.schema.registry.url", schemaRegistryContainer.getSchemaRegistryUrl()); | ||
return config; | ||
} | ||
} |
Oops, something went wrong.