forked from apache/camel-quarkus
-
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.
Debezium PostgresSQL Connector native support apache#1191
- Loading branch information
1 parent
8888ad5
commit fc8f0f2
Showing
20 changed files
with
529 additions
and
102 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ main: | |
- main-xml-jaxb | ||
database: | ||
- couchdb | ||
- debezium-postgres | ||
- influxdb | ||
- jdbc | ||
- kudu | ||
|
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,30 @@ | ||
[[debezium-postgres]] | ||
= Debezium Postgres Extension | ||
|
||
*Since Camel Quarkus 1.0.0-M6* | ||
|
||
*Only consumer is supported* | ||
|
||
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. | ||
|
||
[source,xml] | ||
------------------------------------------------------------ | ||
<dependency> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>camel-debezium-postgres</artifactId> | ||
</dependency> | ||
------------------------------------------------------------ | ||
|
||
== Usage | ||
|
||
The extension provides support for the Camel https://camel.apache.org/components/latest/debezium-postgres-component.html[Debezium Postgres Connector]. | ||
|
||
=== Limitations | ||
|
||
Not all offset stores are supported in the native mode. Supported ones are: | ||
|
||
* org.apache.kafka.connect.storage.FileOffsetBackingStore | ||
* org.apache.kafka.connect.storage.MemoryOffsetBackingStore | ||
|
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
47 changes: 0 additions & 47 deletions
47
...pache/camel/quarkus/component/debezium/postgres/deployment/DebeziumPostgresProcessor.java
This file was deleted.
Oops, something went wrong.
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
64 changes: 64 additions & 0 deletions
64
...pache/camel/quarkus/component/debezium/postgres/deployment/DebeziumPostgresProcessor.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,64 @@ | ||
/* | ||
* 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.quarkus.component.debezium.postgres.deployment; | ||
|
||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.CombinedIndexBuildItem; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
import io.quarkus.deployment.builditem.IndexDependencyBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; | ||
import org.jboss.jandex.IndexView; | ||
|
||
class DebeziumPostgresProcessor { | ||
|
||
private static final String FEATURE = "camel-debezium-postgres"; | ||
|
||
@BuildStep | ||
FeatureBuildItem feature() { | ||
return new FeatureBuildItem(FEATURE); | ||
} | ||
|
||
@BuildStep | ||
ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex) { | ||
IndexView index = combinedIndex.getIndex(); | ||
|
||
String[] dtos = index.getKnownClasses().stream().map(ci -> ci.name().toString()) | ||
.filter(n -> n.startsWith("org.apache.kafka.connect.json") | ||
|| n.startsWith("io.debezium.embedded.spi")) | ||
.sorted() | ||
.toArray(String[]::new); | ||
|
||
return new ReflectiveClassBuildItem(false, true, dtos); | ||
} | ||
|
||
@BuildStep | ||
ReflectiveClassBuildItem reflectiveClasses() { | ||
return new ReflectiveClassBuildItem(false, false, | ||
new String[] { "org.apache.kafka.connect.storage.FileOffsetBackingStore", | ||
"org.apache.kafka.connect.storage.MemoryOffsetBackingStore", | ||
"io.debezium.connector.postgresql.PostgresConnector", | ||
"io.debezium.connector.postgresql.PostgresConnectorTask" }); | ||
} | ||
|
||
@BuildStep | ||
void addDependencies(BuildProducer<IndexDependencyBuildItem> indexDependency) { | ||
indexDependency.produce(new IndexDependencyBuildItem("org.apache.kafka", "connect-json")); | ||
indexDependency.produce(new IndexDependencyBuildItem("io.debezium", "debezium-connector-postgres")); | ||
indexDependency.produce(new IndexDependencyBuildItem("io.debezium", "debezium-embedded")); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
...in/java/org/apache/camel/quarkus/component/debezium/postgres/graal/SubstituteMetrics.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,38 @@ | ||
/* | ||
* 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.quarkus.component.debezium.postgres.graal; | ||
|
||
import com.oracle.svm.core.annotate.Substitute; | ||
import com.oracle.svm.core.annotate.TargetClass; | ||
import org.slf4j.Logger; | ||
|
||
@TargetClass(io.debezium.metrics.Metrics.class) | ||
final class SubstituteMetrics { | ||
|
||
@Substitute | ||
public synchronized void register(Logger logger) { | ||
//JMX is not supported in the native mode | ||
//because there is no API for avoiding MBean registration, substitution is used to skip registration | ||
// enhancement in debezium:https://issues.redhat.com/browse/DBZ-2089 | ||
logger.warn("Metrics are not registered in native mode."); | ||
} | ||
|
||
@Substitute | ||
public final void unregister(Logger logger) { | ||
logger.debug("Metrics are not unregistered in native mode."); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
extensions/debezium-postgres/runtime/src/main/resources/META-INF/beans.xml
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,18 @@ | ||
<!-- | ||
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. | ||
--> |
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
Oops, something went wrong.