-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debezium date format + trustServerCertificate flag (#104)
* debezium date formating * trustServerCertificate * Update sourceProxy.js * license headers
- Loading branch information
1 parent
cce5fc8
commit 1003342
Showing
11 changed files
with
202 additions
and
93 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
**/.DS_Store | ||
**/.vscode | ||
bin | ||
obj | ||
obj |
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
16 changes: 16 additions & 0 deletions
16
sources/relational/debezium-reactivator/src/main/java/com/drasi/DeprovisionController.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
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
80 changes: 80 additions & 0 deletions
80
sources/relational/debezium-reactivator/src/main/java/com/drasi/TemporalConverter.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,80 @@ | ||
/* | ||
* Copyright 2024 The Drasi Authors. | ||
* | ||
* 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 com.drasi; | ||
|
||
import io.debezium.spi.converter.CustomConverter; | ||
import io.debezium.spi.converter.RelationalColumn; | ||
import org.apache.kafka.connect.data.SchemaBuilder; | ||
|
||
import java.sql.Types; | ||
import java.time.*; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Properties; | ||
|
||
public class TemporalConverter implements CustomConverter<SchemaBuilder, RelationalColumn> { | ||
|
||
@Override | ||
public void configure(Properties props) { | ||
} | ||
|
||
@Override | ||
public void converterFor(RelationalColumn column, | ||
CustomConverter.ConverterRegistration<SchemaBuilder> registration) { | ||
|
||
switch (column.jdbcType()) { | ||
case Types.TIMESTAMP: | ||
registration.register(SchemaBuilder.string().name(column.name()), x -> { | ||
switch (x) { | ||
case null: | ||
return null; | ||
case Instant instant: | ||
return DateTimeFormatter.ISO_INSTANT.format(instant); | ||
case LocalDateTime localDateTime: | ||
return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(localDateTime); | ||
default: | ||
return x.toString(); | ||
} | ||
}); | ||
break; | ||
case Types.DATE: | ||
registration.register(SchemaBuilder.string().name(column.name()), x -> { | ||
switch (x) { | ||
case null: | ||
return null; | ||
case LocalDate localDate: | ||
return DateTimeFormatter.ISO_LOCAL_DATE.format(localDate); | ||
default: | ||
return x.toString(); | ||
} | ||
}); | ||
break; | ||
case Types.TIME: | ||
registration.register(SchemaBuilder.string().name(column.name()), x -> { | ||
switch (x) { | ||
case null: | ||
return null; | ||
case LocalTime localTime: | ||
return DateTimeFormatter.ISO_LOCAL_TIME.format(localTime); | ||
default: | ||
return x.toString(); | ||
} | ||
}); | ||
break; | ||
|
||
} | ||
} | ||
} |
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