- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中io.debezium.time.ZonedTimestamp
类的一些代码示例,展示了ZonedTimestamp
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonedTimestamp
类的具体详情如下:
包路径:io.debezium.time.ZonedTimestamp
类名称:ZonedTimestamp
[英]A utility for converting various Java time representations into the SchemaBuilder#string() representation of the time and date in a particular time zone, and for defining a Kafka Connect Schema for zoned timestamp values.
The ISO date-time format includes the date, time (including fractional parts), and offset from UTC, such as '2011-12-03T10:15:30+01:00'.
[中]用于将各种Java时间表示转换为特定时区中时间和日期的SchemaBuilder#string()表示,以及为分区时间戳值定义Kafka Connect模式的实用程序。
ISO日期时间格式包括日期、时间(包括小数部分)和与UTC的偏移量,例如“2011-12-03T10:15:30+01:00”。
代码示例来源:origin: debezium/debezium
/**
* Returns a Schema for a {@link ZonedTimestamp} but with all other default Schema settings.
*
* @return the schema
* @see #builder()
*/
public static Schema schema() {
return builder().build();
}
代码示例来源:origin: debezium/debezium
/**
* Get the ISO 8601 formatted representation of the given {@link java.util.Date} or one of its JDBC subclasses, using
* the supplied timezone information.
*
* @param timestamp the timestamp value
* @param zoneId the timezone identifier or offset where the timestamp is defined
* @param adjuster the optional component that adjusts the local date value before obtaining the epoch day; may be null if no
* adjustment is necessary
* @return the ISO 8601 formatted string
*/
public static String toIsoString(java.util.Date timestamp, ZoneId zoneId, TemporalAdjuster adjuster) {
if (timestamp instanceof java.sql.Timestamp) {
return toIsoString((java.sql.Timestamp) timestamp, zoneId, adjuster);
}
if (timestamp instanceof java.sql.Date) {
return toIsoString((java.sql.Date) timestamp, zoneId, adjuster);
}
if (timestamp instanceof java.sql.Time) {
return toIsoString((java.sql.Time) timestamp, zoneId, adjuster);
}
return timestamp.toInstant().atZone(zoneId).format(FORMATTER);
}
代码示例来源:origin: debezium/debezium
@Override
public SchemaBuilder schemaBuilder(Column column) {
switch (column.jdbcType()) {
// Numeric integers
case Types.TINYINT:
// values are an 8-bit unsigned integer value between 0 and 255, we thus need to store it in short int
return SchemaBuilder.int16();
// Floating point
case microsoft.sql.Types.SMALLMONEY:
case microsoft.sql.Types.MONEY:
return SpecialValueDecimal.builder(decimalMode, column.length(), column.scale().get());
case microsoft.sql.Types.DATETIMEOFFSET:
return ZonedTimestamp.builder();
default:
return super.schemaBuilder(column);
}
}
代码示例来源:origin: debezium/debezium
return toIsoString((OffsetDateTime) value, adjuster);
return toIsoString((ZonedDateTime) value, adjuster);
return toIsoString((OffsetTime) value, adjuster);
return toIsoString((java.util.Date) value, defaultZone, adjuster);
代码示例来源:origin: debezium/debezium
return ZonedTime.builder();
case Types.TIMESTAMP_WITH_TIMEZONE:
return ZonedTimestamp.builder();
代码示例来源:origin: debezium/debezium
/**
* Converts a value object for an expected JDBC type of {@link Types#TIMESTAMP_WITH_TIMEZONE}.
* The <a href="http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html">standard ANSI to Java 8 type
* mappings</a> specify that the preferred mapping (when using JDBC's {@link java.sql.ResultSet#getObject(int) getObject(...)}
* methods) in Java 8 is to return {@link OffsetDateTime} for these values.
* <p>
* This method handles several types of objects, including {@link OffsetDateTime}, {@link java.sql.Timestamp},
* {@link java.util.Date}, {@link java.time.LocalTime}, and {@link java.time.LocalDateTime}.
*
* @param column the column definition describing the {@code data} value; never null
* @param fieldDefn the field definition; never null
* @param data the data object to be converted into a {@link Date Kafka Connect date} type; never null
* @return the converted value, or null if the conversion could not be made and the column allows nulls
* @throws IllegalArgumentException if the value could not be converted but the column does not allow nulls
*/
protected Object convertTimestampWithZone(Column column, Field fieldDefn, Object data) {
// epoch is the fallback value
return convertValue(column, fieldDefn, data, OffsetDateTime.of(LocalDate.ofEpochDay(0), LocalTime.MIDNIGHT, defaultOffset), (r) -> {
try {
r.deliver(ZonedTimestamp.toIsoString(data, defaultOffset, adjuster));
} catch (IllegalArgumentException e) {
}
});
}
代码示例来源:origin: debezium/debezium
case PgOid.TIMESTAMPTZ:
return ZonedTimestamp.builder();
case PgOid.TIMETZ:
代码示例来源:origin: debezium/debezium
String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);
代码示例来源:origin: debezium/debezium
Bits.builder(2).optional().build());
assertTableSchema("public.time_table", "ts, tz, date, ti, ttz, it",
MicroTimestamp.builder().optional().build(), ZonedTimestamp.builder().optional().build(),
Date.builder().optional().build(), MicroTime.builder().optional().build(), ZonedTime.builder().optional().build(),
MicroDuration.builder().optional().build());
代码示例来源:origin: debezium/debezium
String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);
代码示例来源:origin: io.debezium/debezium-core
/**
* Returns a Schema for a {@link ZonedTimestamp} but with all other default Schema settings.
*
* @return the schema
* @see #builder()
*/
public static Schema schema() {
return builder().build();
}
代码示例来源:origin: debezium/debezium
String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);
String isoString5 = ZonedTimestamp.toIsoString(t5, ZoneOffset.UTC, MySqlValueConverters::adjustTemporal);
assertThat(schemaJ.defaultValue()).isEqualTo(
MySQLConnection.forTestDatabase(DATABASE.getDatabaseName())
代码示例来源:origin: io.debezium/debezium-connector-oracle
@Override
public SchemaBuilder schemaBuilder(Column column) {
logger.debug("Building schema for column {} of type {} named {} with constraints ({},{})",
column.name(),
column.jdbcType(),
column.typeName(),
column.length(),
column.scale()
);
switch (column.jdbcType()) {
// Oracle's float is not float as in Java but a NUMERIC without scale
case Types.FLOAT:
return VariableScaleDecimal.builder();
case Types.NUMERIC:
return getNumericSchema(column);
case OracleTypes.BINARY_FLOAT:
return SchemaBuilder.float32();
case OracleTypes.BINARY_DOUBLE:
return SchemaBuilder.float64();
case OracleTypes.TIMESTAMPTZ:
case OracleTypes.TIMESTAMPLTZ:
return ZonedTimestamp.builder();
case OracleTypes.INTERVALYM:
case OracleTypes.INTERVALDS:
return MicroDuration.builder();
default:
return super.schemaBuilder(column);
}
}
代码示例来源:origin: debezium/debezium
String isoStringA = ZonedTimestamp.toIsoString(a, ZoneOffset.UTC, MySqlValueConverters::adjustTemporal);
assertThat(schemaA.defaultValue()).isEqualTo(isoStringA);
代码示例来源:origin: io.debezium/debezium-core
return ZonedTime.builder();
case Types.TIMESTAMP_WITH_TIMEZONE:
return ZonedTimestamp.builder();
代码示例来源:origin: io.debezium/debezium-core
/**
* Get the ISO 8601 formatted representation of the given {@link java.util.Date} or one of its JDBC subclasses, using
* the supplied timezone information.
*
* @param timestamp the timestamp value
* @param zoneId the timezone identifier or offset where the timestamp is defined
* @param adjuster the optional component that adjusts the local date value before obtaining the epoch day; may be null if no
* adjustment is necessary
* @return the ISO 8601 formatted string
*/
public static String toIsoString(java.util.Date timestamp, ZoneId zoneId, TemporalAdjuster adjuster) {
if (timestamp instanceof java.sql.Timestamp) {
return toIsoString((java.sql.Timestamp) timestamp, zoneId, adjuster);
}
if (timestamp instanceof java.sql.Date) {
return toIsoString((java.sql.Date) timestamp, zoneId, adjuster);
}
if (timestamp instanceof java.sql.Time) {
return toIsoString((java.sql.Time) timestamp, zoneId, adjuster);
}
return timestamp.toInstant().atZone(zoneId).format(FORMATTER);
}
代码示例来源:origin: io.debezium/debezium-connector-postgres
case PgOid.TIMESTAMPTZ:
return ZonedTimestamp.builder();
case PgOid.TIMETZ:
代码示例来源:origin: io.debezium/debezium-core
return toIsoString((OffsetDateTime) value, adjuster);
return toIsoString((ZonedDateTime) value, adjuster);
return toIsoString((OffsetTime) value, adjuster);
return toIsoString((java.util.Date) value, defaultZone, adjuster);
代码示例来源:origin: io.debezium/debezium-connector-postgres
Bits.builder(2).optional().build());
assertTableSchema("public.time_table", "ts, tz, date, ti, ttz, it",
MicroTimestamp.builder().optional().build(), ZonedTimestamp.builder().optional().build(),
Date.builder().optional().build(), MicroTime.builder().optional().build(), ZonedTime.builder().optional().build(),
MicroDuration.builder().optional().build());
代码示例来源:origin: io.debezium/debezium-core
/**
* Converts a value object for an expected JDBC type of {@link Types#TIMESTAMP_WITH_TIMEZONE}.
* The <a href="http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html">standard ANSI to Java 8 type
* mappings</a> specify that the preferred mapping (when using JDBC's {@link java.sql.ResultSet#getObject(int) getObject(...)}
* methods) in Java 8 is to return {@link OffsetDateTime} for these values.
* <p>
* This method handles several types of objects, including {@link OffsetDateTime}, {@link java.sql.Timestamp},
* {@link java.util.Date}, {@link java.time.LocalTime}, and {@link java.time.LocalDateTime}.
*
* @param column the column definition describing the {@code data} value; never null
* @param fieldDefn the field definition; never null
* @param data the data object to be converted into a {@link Date Kafka Connect date} type; never null
* @return the converted value, or null if the conversion could not be made and the column allows nulls
* @throws IllegalArgumentException if the value could not be converted but the column does not allow nulls
*/
protected Object convertTimestampWithZone(Column column, Field fieldDefn, Object data) {
// epoch is the fallback value
return convertValue(column, fieldDefn, data, OffsetDateTime.of(LocalDate.ofEpochDay(0), LocalTime.MIDNIGHT, defaultOffset), (r) -> {
try {
r.deliver(ZonedTimestamp.toIsoString(data, defaultOffset, adjuster));
} catch (IllegalArgumentException e) {
}
});
}
提供了一个用例: 流处理架构;事件进入 Kafka,然后由带有 MongoDB 接收器的作业进行处理。 数据库名称:myWebsite集合:用户 并且作业接收 users 集合中的 user 记录。
如何删除 debezium 连接器。我正在关注本教程 https://debezium.io/documentation/reference/tutorial.html我看到了注册连接器的方法,但不知
如何删除 debezium 连接器。我正在关注本教程 https://debezium.io/documentation/reference/tutorial.html我看到了注册连接器的方法,但不知
有人可以告诉我将嵌入式 Debezium(不带 kafka)与 osgi bundle 一起使用与将 Debezium 与 kafka 一起使用有什么区别吗?我在互联网上找不到很多关于 Debeziu
我打算使用 debezium用于产生事件到 Kafka我需要强大的交货和订购保证。通过使用 enable.idempotence=true生产者配置中的参数我可以得到这些保证。 我的问题是: 我怎样才
我有一个来自https://hub.docker.com/r/debezium/zookeeper:1.2图像和我的Compose文件的正在运行的Zookeeper实例: version: "3.7"
在我们的应用程序中,我们需要将某个 postgresql 表中的事件发布到 Kafka 中,因此我们决定使用 Debezium,但遇到了以下问题:在初始快照期间,Kafka 中的消息意外出现(从我们的
本文整理了Java中io.debezium.time.ZonedTimestamp类的一些代码示例,展示了ZonedTimestamp类的具体用法。这些代码示例主要来源于Github/Stackove
本文整理了Java中io.debezium.time.ZonedTime类的一些代码示例,展示了ZonedTime类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Mave
我正在尝试使用 Debezium 连接到本地计算机上的 mysql 数据库。 尝试使用以下命令调用kafka:sudo kafka/bin/connect-standalone.shsh kafka/
我安装成功 Postgres Debezium CDC .现在,我能够捕捉到数据库发生的所有变化。但问题是“之前”字段始终为空。所以,如果我插入一条记录 (id = 1, name = Bill)然后
客观的: 需要向现有的 Debezium MySQL 连接器版本 1.1.1.Final 添加一个新表。在使用更新的配置(table.whitelist 中的新表)重新启动连接器后,应将表中的数据填充
我有一些带有 bg_ 和 cp_ 前缀的数据库表,例如“bg_table1”、“bg_table2”和“cp_table1”。还有一些没有任何前缀的其他表,例如 my_table1、user_acti
有人使用Debezium kafka测试集群进行Gradle单元测试吗? 我有一个Vertx gradle项目,想将debezium测试群集与我的verticl kafka客户端测试集成。 我的第一个
我在Postgres中有一个数据库,其中的表“product”与“sales_Channel”连接为1到n。因此,一个产品可以有多个SalesChannel。现在,我想将其传输到ES并保持最新状态,因
我想我可能遗漏了一些配置,但我们正在尝试使用 Debezium 对一个表中的所有行进行快照,该表有大约 800 万条记录,一段时间后它停止了。 连接器配置是: { "connector.clas
我想我可能遗漏了一些配置,但我们正在尝试使用 Debezium 对一个表中的所有行进行快照,该表有大约 800 万条记录,一段时间后它停止了。 连接器配置是: { "connector.clas
我们正在使用 Debezium + PostgreSQL。 请注意,我们有 4 种类型的事件用于创建、读取、更新和删除 - c、r、u 和 d。 我们的应用程序未使用事件的读取类型。实际上,除非我们正
我正在尝试使用 Debezium 和 Kafka 进行 CDC。我在 table.whitelist 属性中注册了一个包含 3 个表的连接器,它工作正常。这是运行连接器的配置。 {"name":"xo
我想将 Debezium 与 kafka connect 结合使用,但我需要在交易结束时完成这项工作。该事务更新了许多表。我可以获得每条消息的 GTID,但我如何知道我何时收到了该交易的所有消息?在我
我是一名优秀的程序员,十分优秀!