@PublicEvolving public class JdbcSink extends Object
sinks.| 限定符和类型 | 方法和说明 |
|---|---|
static <T> org.apache.flink.streaming.api.functions.sink.SinkFunction<T> |
exactlyOnceSink(String sql,
JdbcStatementBuilder<T> statementBuilder,
JdbcExecutionOptions executionOptions,
JdbcExactlyOnceOptions exactlyOnceOptions,
org.apache.flink.util.function.SerializableSupplier<XADataSource> dataSourceSupplier)
Create JDBC sink which provides exactly-once guarantee.
|
static <T> org.apache.flink.streaming.api.functions.sink.SinkFunction<T> |
sink(String sql,
JdbcStatementBuilder<T> statementBuilder,
JdbcConnectionOptions connectionOptions)
Create a JDBC sink with the default
JdbcExecutionOptions. |
static <T> org.apache.flink.streaming.api.functions.sink.SinkFunction<T> |
sink(String sql,
JdbcStatementBuilder<T> statementBuilder,
JdbcExecutionOptions executionOptions,
JdbcConnectionOptions connectionOptions)
Create a JDBC sink.
|
public static <T> org.apache.flink.streaming.api.functions.sink.SinkFunction<T> sink(String sql, JdbcStatementBuilder<T> statementBuilder, JdbcConnectionOptions connectionOptions)
JdbcExecutionOptions.public static <T> org.apache.flink.streaming.api.functions.sink.SinkFunction<T> sink(String sql, JdbcStatementBuilder<T> statementBuilder, JdbcExecutionOptions executionOptions, JdbcConnectionOptions connectionOptions)
Note: the objects passed to the return sink can be processed in batch and retried.
Therefore, objects can not be reused.
T - type of data in StreamRecord.sql - arbitrary DML query (e.g. insert, update, upsert)statementBuilder - sets parameters on PreparedStatement according to
the queryexecutionOptions - parameters of execution, such as batch size and maximum retriesconnectionOptions - parameters of connection, such as JDBC URLpublic static <T> org.apache.flink.streaming.api.functions.sink.SinkFunction<T> exactlyOnceSink(String sql, JdbcStatementBuilder<T> statementBuilder, JdbcExecutionOptions executionOptions, JdbcExactlyOnceOptions exactlyOnceOptions, org.apache.flink.util.function.SerializableSupplier<XADataSource> dataSourceSupplier)
Note: the objects passed to the return sink can be processed in batch and retried.
Therefore, objects can not be reused.
T - type of data in StreamRecord.sql - arbitrary DML query (e.g. insert, update, upsert)statementBuilder - sets parameters on PreparedStatement according to
the queryexecutionOptions - parameters of execution, such as batch size and maximum retriesexactlyOnceOptions - exactly-once options. Note: maxRetries setting must be strictly set
to 0 for the created sink to work properly and not to produce duplicates. See issue
FLINK-22311 for details.dataSourceSupplier - supplies the XADataSourceCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.