@PublicEvolving public class JdbcSink extends Object
sinks
.Modifier and Type | Method and Description |
---|---|
static <T> SinkFunction<T> |
exactlyOnceSink(String sql,
JdbcStatementBuilder<T> statementBuilder,
JdbcExecutionOptions executionOptions,
JdbcExactlyOnceOptions exactlyOnceOptions,
SerializableSupplier<XADataSource> dataSourceSupplier)
Create JDBC sink which provides exactly-once guarantee.
|
static <T> SinkFunction<T> |
sink(String sql,
JdbcStatementBuilder<T> statementBuilder,
JdbcConnectionOptions connectionOptions)
Create a JDBC sink with the default
JdbcExecutionOptions . |
static <T> SinkFunction<T> |
sink(String sql,
JdbcStatementBuilder<T> statementBuilder,
JdbcExecutionOptions executionOptions,
JdbcConnectionOptions connectionOptions)
Create a JDBC sink.
|
public static <T> SinkFunction<T> sink(String sql, JdbcStatementBuilder<T> statementBuilder, JdbcConnectionOptions connectionOptions)
JdbcExecutionOptions
.public static <T> 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> SinkFunction<T> exactlyOnceSink(String sql, JdbcStatementBuilder<T> statementBuilder, JdbcExecutionOptions executionOptions, JdbcExactlyOnceOptions exactlyOnceOptions, 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 XADataSource
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.