Skip to content

Commit

Permalink
Small CDC connector fixes (#1339)
Browse files Browse the repository at this point in the history
- use hazelcast-enterprise instead of hazelcast oss
- java 17 used

---------

Co-authored-by: Oliver Howell <[email protected]>
  • Loading branch information
TomaszGaweda and oliverhowell authored Oct 30, 2024
1 parent c7b8bc6 commit e2d02c7
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 28 deletions.
49 changes: 45 additions & 4 deletions docs/modules/integrate/pages/cdc-connectors.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,47 @@ PostgreSQL-specific connector:
</dependency>
----

Because all these artifacts are in Hazelcast's private repository, you also have to add:

[tabs]
====
Maven::
+
--
[source,xml]
----
<repositories>
<repository>
<id>private-repository</id>
<name>Hazelcast Private Repository</name>
<url>https://repository.hazelcast.com/release/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
----
--
Gradle::
+
--
[source,groovy]
----
repositories {
mavenCentral()
maven {
url = uri("https://repository.hazelcast.com/release/")
}
mavenLocal()
}
----
--
====
to your `pom.xml`.

== CDC as a source

The Java API supports the following types of CDC source:
Expand Down Expand Up @@ -208,7 +249,7 @@ p.readFrom(source)
====
The key and value functions have certain limitations. They can be used to map only to objects which the Hazelcast member can deserialize, which unfortunately doesn't include user code submitted as a part of the job. So in the above example it's OK to have `String` email values, but we wouldn't be able to use `Customer` directly.
If user code has to be used, then the problem can be solved with the help of the User Code Deployment feature. Example configs for that can be seen in our xref:pipelines:cdc-join.adoc#7-start-hazelcast-jet[CDC Join tutorial].
If user code has to be used, then the problem can be solved with the help of the User Code Deployment feature. Example configs for that can be seen in our xref:pipelines:cdc-join.adoc#step-7-start-hazelcast[CDC Join tutorial].
====

== Data types
Expand All @@ -230,7 +271,7 @@ Each database type has its own database type-to-struct type mappings. For specif
|io.debezium.time.Date|java.time.LocalDate / java.util.Date / String `yyyy-MM-dd`
|io.debezium.time.Time|java.time.Duration / String ISO-8601 `PnDTnHnMn.nS`

.5+|INT64
.6+|INT64
|-|long/Long
|io.debezium.time.Timestamp|java.time.Instant / String `yyyy-MM-dd HH:mm:ss.SSS`
|io.debezium.time.MicroTimestamp|java.time.Instant / String `yyyy-MM-dd HH:mm:ss.SSS`
Expand All @@ -243,6 +284,8 @@ Each database type has its own database type-to-struct type mappings. For specif
|BOOLEAN|-|boolean/Boolean / String
|STRING|-|String

|===

The `RecordPart#value` field contains Debezium's message in a JSON format. This JSON format uses string as date representation,
instead of ints, which are standard in Debezium but harder to work with.

Expand All @@ -252,8 +295,6 @@ We strongly recommend using `time.precision.mode=adaptive` (default).
Using `time.precision.mode=connect` uses `java.util.Date` to represent dates, time, etc. and is less precise.
====

|===

== Migration tips

Hazelcast {open-source-product-name} has a Debezium CDC connector, but it's based on an older version of Debezium.
Expand Down
7 changes: 4 additions & 3 deletions docs/modules/pipelines/pages/cdc-join.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ all the code that we have written.
For this reason we create a JAR containing everything we need. All we
need to do is to run the build command:

[tabs]
[tabs]
====
Gradle::
+
Expand All @@ -575,8 +575,8 @@ gradle build
This will produce a JAR file called `cdc-tutorial-1.0-SNAPSHOT.jar`
in the `build/libs` directory of our project.
--
Maven::
+
Maven::
+
--
[source,bash]
----
Expand All @@ -588,6 +588,7 @@ in the `target` directory or our project.
--
====

[#step-7-start-hazelcast]
== Step 7. Start Hazelcast

. xref:getting-started:install-hazelcast.adoc[Download Hazelcast].
Expand Down
29 changes: 24 additions & 5 deletions docs/modules/pipelines/pages/cdc-postgres.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ plugins {
group 'org.example'
version '1.0-SNAPSHOT'
repositories.mavenCentral()
repositories {
mavenCentral()
maven {
url = uri("https://repository.hazelcast.com/release/")
}
mavenLocal()
}
dependencies {
implementation 'com.hazelcast:hazelcast:{full-version}'
Expand All @@ -218,14 +224,27 @@ Maven::
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.release>17</maven.compiler.release>
</properties>
<repositories>
<repository>
<id>private-repository</id>
<name>Hazelcast Private Repository</name>
<url>https://repository.hazelcast.com/release/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<artifactId>hazelcast-enterprise</artifactId>
<version>{full-version}</version>
</dependency>
<dependency>
Expand All @@ -241,7 +260,7 @@ Maven::
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.11.0</version>
<version>2.18.0</version>
</dependency>
</dependencies>
Expand Down
52 changes: 36 additions & 16 deletions docs/modules/pipelines/pages/cdc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,19 @@ plugins {
group 'org.example'
version '1.0-SNAPSHOT'
repositories.mavenCentral()
repositories {
mavenCentral()
maven {
url = uri("https://repository.hazelcast.com/release/")
}
mavenLocal()
}
dependencies {
implementation 'com.hazelcast:hazelcast:{full-version}'
implementation 'com.hazelcast:hazelcast-enterprise:{full-version}'
implementation 'com.hazelcast.jet:hazelcast-enterprise-cdc-debezium:{full-version}'
implementation 'com.hazelcast.jet:hazelcast-enterprise-cdc-mysql:{full-version}'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.11.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.18.0'
}
jar.manifest.attributes 'Main-Class': 'org.example.JetJob'
Expand All @@ -224,17 +230,31 @@ Maven::
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>org.example</groupId>
<artifactId>cdc-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.release>17</maven.compiler.target>
</properties>
<dependencies>
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>cdc-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.release>17</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>private-repository</id>
<name>Hazelcast Private Repository</name>
<url>https://repository.hazelcast.com/release/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
Expand All @@ -253,9 +273,9 @@ Maven::
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.11.0</version>
<version>2.18.0</version>
</dependency>
</dependencies>
</dependencies>
<build>
<plugins>
Expand Down

0 comments on commit e2d02c7

Please sign in to comment.