public class JDBCUpsertOutputFormat extends AbstractJDBCOutputFormat<Tuple2<Boolean,Row>>
Modifier and Type | Class and Description |
---|---|
static class |
JDBCUpsertOutputFormat.Builder
Builder for a
JDBCUpsertOutputFormat . |
connection, dbURL
Constructor and Description |
---|
JDBCUpsertOutputFormat(JDBCOptions options,
String[] fieldNames,
String[] keyFields,
int[] fieldTypes,
int flushMaxSize,
long flushIntervalMills,
int maxRetryTimes) |
Modifier and Type | Method and Description |
---|---|
static JDBCUpsertOutputFormat.Builder |
builder() |
void |
close()
Executes prepared statement and closes all resources of this instance.
|
void |
flush() |
void |
open(int taskNumber,
int numTasks)
Connects to the target database and initializes the prepared statement.
|
void |
writeRecord(Tuple2<Boolean,Row> tuple2)
Adds a record to the output.
|
closeDbConnection, configure, establishConnection
getRuntimeContext, setRuntimeContext
public JDBCUpsertOutputFormat(JDBCOptions options, String[] fieldNames, String[] keyFields, int[] fieldTypes, int flushMaxSize, long flushIntervalMills, int maxRetryTimes)
public void open(int taskNumber, int numTasks) throws IOException
taskNumber
- The number of the parallel instance.numTasks
- The number of parallel tasks.IOException
- Thrown, if the output could not be opened due to an
I/O problem.public void writeRecord(Tuple2<Boolean,Row> tuple2) throws IOException
OutputFormat
When this method is called, the output format it guaranteed to be opened.
tuple2
- The records to add to the output.IOException
- Thrown, if the records could not be added to to an I/O problem.public void close() throws IOException
IOException
- Thrown, if the input could not be closed properly.public static JDBCUpsertOutputFormat.Builder builder()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.