forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Debezium Source for MS SQL Server (apache#12256)
- Loading branch information
Showing
11 changed files
with
506 additions
and
0 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
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,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. | ||
--> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.pulsar</groupId> | ||
<artifactId>pulsar-io-debezium</artifactId> | ||
<version>2.9.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>pulsar-io-debezium-mssql</artifactId> | ||
<name>Pulsar IO :: Debezium :: Microsoft SQL</name> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>pulsar-io-debezium-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.debezium</groupId> | ||
<artifactId>debezium-connector-sqlserver</artifactId> | ||
<version>${debezium.version}</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.nifi</groupId> | ||
<artifactId>nifi-nar-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
37 changes: 37 additions & 0 deletions
37
...debezium/mssql/src/main/java/org/apache/pulsar/io/debezium/mssql/DebeziumMsSqlSource.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,37 @@ | ||
/** | ||
* 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.pulsar.io.debezium.mssql; | ||
|
||
import java.util.Map; | ||
|
||
import org.apache.kafka.connect.runtime.TaskConfig; | ||
import org.apache.pulsar.io.debezium.DebeziumSource; | ||
|
||
|
||
/** | ||
* A pulsar source that runs debezium mssql source | ||
*/ | ||
public class DebeziumMsSqlSource extends DebeziumSource { | ||
private static final String DEFAULT_TASK = "io.debezium.connector.sqlserver.SqlServerConnectorTask"; | ||
|
||
@Override | ||
public void setDbConnectorTask(Map<String, Object> config) throws Exception { | ||
throwExceptionIfConfigNotMatch(config, TaskConfig.TASK_CLASS_CONFIG, DEFAULT_TASK); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
pulsar-io/debezium/mssql/src/main/resources/META-INF/services/pulsar-io.yaml
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,22 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
name: debezium-mssql | ||
description: Debezium Microsoft SQL Server Source | ||
sourceClass: org.apache.pulsar.io.debezium.mssql.DebeziumMsSqlSource |
36 changes: 36 additions & 0 deletions
36
pulsar-io/debezium/mssql/src/main/resources/debezium-mssql-source-config.yaml
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,36 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
tenant: "public" | ||
namespace: "default" | ||
name: "debezium-mssql-source" | ||
topicName: "debezium-mssql-topic" | ||
archive: "connectors/pulsar-io-debezium-mssql-2.9.0-SNAPSHOT.nar" | ||
|
||
parallelism: 1 | ||
|
||
configs: | ||
database.hostname: "localhost" | ||
database.port: "1521" | ||
database.user: "sa" | ||
database.password: "MyP@ssword1" | ||
database.dbname: "MyDB" | ||
database.server.name: "mssql" | ||
|
||
database.history.pulsar.service.url: "pulsar://127.0.0.1:6650" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
.../src/test/java/org/apache/pulsar/tests/integration/containers/DebeziumMsSqlContainer.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,68 @@ | ||
/** | ||
* 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.pulsar.tests.integration.containers; | ||
|
||
|
||
import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; | ||
|
||
import java.time.Duration; | ||
import java.time.temporal.ChronoUnit; | ||
|
||
public class DebeziumMsSqlContainer extends ChaosContainer<DebeziumMsSqlContainer> { | ||
|
||
// This password needs to include at least 8 characters of at least three of these four categories: | ||
// uppercase letters, lowercase letters, numbers and non-alphanumeric symbols | ||
public static final String SA_PASSWORD = "p@ssw0rD"; | ||
public static final String NAME = "debezium-mssql"; | ||
static final Integer[] PORTS = { 1433 }; | ||
|
||
// https://hub.docker.com/_/microsoft-mssql-server | ||
// EULA: https://go.microsoft.com/fwlink/?linkid=857698 | ||
// "You may install and use copies of the software on any device, | ||
// including third party shared devices, to design, develop, test and demonstrate your programs. | ||
// You may not use the software on a device or server in a production environment." | ||
private static final String IMAGE_NAME = "mcr.microsoft.com/mssql/server:2019-latest"; | ||
|
||
public DebeziumMsSqlContainer(String clusterName) { | ||
super(clusterName, IMAGE_NAME); | ||
} | ||
|
||
@Override | ||
public String getContainerName() { | ||
return clusterName; | ||
} | ||
|
||
@Override | ||
protected void configure() { | ||
super.configure(); | ||
// leaving default MSSQL_PID (aka Developer edition) | ||
this.withNetworkAliases(NAME) | ||
.withExposedPorts(PORTS) | ||
.withEnv("ACCEPT_EULA", "Y") | ||
.withEnv("SA_PASSWORD", SA_PASSWORD) | ||
.withEnv("MSSQL_AGENT_ENABLED", "true") | ||
.withStartupTimeout(Duration.of(300, ChronoUnit.SECONDS)) | ||
.withCreateContainerCmdModifier(createContainerCmd -> { | ||
createContainerCmd.withHostName(NAME); | ||
createContainerCmd.withName(getContainerName()); | ||
}) | ||
.waitingFor(new HostPortWaitStrategy()); | ||
} | ||
|
||
} |
Oops, something went wrong.