Modifier and Type | Class and Description |
---|---|
private static class |
RecordSqlWriter.ResultSetRecordSetWithCallback |
Modifier and Type | Field and Description |
---|---|
private ResultSetRecordSet |
fullRecordSet |
private int |
maxRowsPerFlowFile |
private String |
mimeType |
private JdbcCommon.AvroConversionOptions |
options |
private Map<String,String> |
originalAttributes |
private RecordSetWriterFactory |
recordSetWriterFactory |
private AtomicReference<WriteResult> |
writeResultRef |
private RecordSchema |
writeSchema |
Constructor and Description |
---|
RecordSqlWriter(RecordSetWriterFactory recordSetWriterFactory,
JdbcCommon.AvroConversionOptions options,
int maxRowsPerFlowFile,
Map<String,String> originalAttributes) |
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
getAttributesToAdd()
Returns a map of attribute key/value pairs to be added to any outgoing flow file(s).
|
String |
getMimeType()
Returns the MIME type of the output format.
|
void |
updateCounters(ProcessSession session)
Updates any session counters as a result of processing result sets.
|
void |
writeEmptyResultSet(OutputStream outputStream,
ComponentLog logger)
Writes an empty result set to the output stream.
|
long |
writeResultSet(ResultSet resultSet,
OutputStream outputStream,
ComponentLog logger,
JdbcCommon.ResultSetRowCallback callback)
Writes the given result set out to the given output stream, possibly applying a callback as each row is processed.
|
private final RecordSetWriterFactory recordSetWriterFactory
private final AtomicReference<WriteResult> writeResultRef
private final JdbcCommon.AvroConversionOptions options
private final int maxRowsPerFlowFile
private ResultSetRecordSet fullRecordSet
private RecordSchema writeSchema
private String mimeType
public RecordSqlWriter(RecordSetWriterFactory recordSetWriterFactory, JdbcCommon.AvroConversionOptions options, int maxRowsPerFlowFile, Map<String,String> originalAttributes)
public long writeResultSet(ResultSet resultSet, OutputStream outputStream, ComponentLog logger, JdbcCommon.ResultSetRowCallback callback) throws Exception
SqlWriter
writeResultSet
in interface SqlWriter
resultSet
- the ResultSet to be writtenoutputStream
- the OutputStream to write the result set tologger
- a common logger that can be used to log messages during writecallback
- a MaxValueResultSetRowCollector that may be called as each row in the ResultSet is processedException
- if any errors occur during the writing of the result set to the output streampublic Map<String,String> getAttributesToAdd()
SqlWriter
getAttributesToAdd
in interface SqlWriter
public void updateCounters(ProcessSession session)
SqlWriter
updateCounters
in interface SqlWriter
session
- the session upon which to update counterspublic void writeEmptyResultSet(OutputStream outputStream, ComponentLog logger) throws IOException
SqlWriter
writeEmptyResultSet
in interface SqlWriter
outputStream
- the OutputStream to write the empty result set tologger
- a common logger that can be used to log messages during writeIOException
- if any errors occur during the writing of an empty result set to the output streampublic String getMimeType()
SqlWriter
getMimeType
in interface SqlWriter
Copyright © 2020 Apache NiFi Project. All rights reserved.