Class DataWriter
java.lang.Object
com.northconcepts.datapipeline.core.DataObject
com.northconcepts.datapipeline.core.Endpoint
com.northconcepts.datapipeline.core.DataEndpoint
com.northconcepts.datapipeline.core.DataWriter
- Direct Known Subclasses:
AbstractWriter,CollectionWriter,EventBusWriter,FileWriter,IntegrationWriter,JdbcUpsertWriter,JdbcWriter,JmsWriter,MapWriter,MemoryWriter,MultiWriter,NullWriter,PipedWriter,ProxyWriter,SplitWriter,StreamWriter,TailWriter,TextStreamWriter
Abstract super-class for writing records. The only method that a subclass must implement is
writeImpl(Record),
however, most subclasses will also override DataEndpoint.open() and DataEndpoint.close().-
Nested Class Summary
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State -
Field Summary
Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYFields inherited from class com.northconcepts.datapipeline.core.Endpoint
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEFields inherited from class com.northconcepts.datapipeline.core.DataObject
id, log, name, TIMESTAMP_FORMAT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Adds this endpoint's current state to aDataException.intReturns the number of records that can probably be written without blocking.Returns theEndpointheld inside this one ornullif there isn't one.Returns theDataWriterheld inside this one ornullif there isn't one.Returns the deepest, nestedEndpointheld inside this one, otherwise this instance is returned if there aren't any nestedEndpoints.Returns the deepest, nestedDataWriterheld inside this one, otherwise this instance is returned if there aren't any nestedDataWriters.<T extends DataWriter>
TReturns the firstDataWriterof the specified type held inside this one ornullif there isn't one.voidWrites the specified record to thisDataWriterand increases the record-count by 1.protected abstract voidOverridden by subclasses to write the specified record to thisDataWriter.Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
close, decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, open, resetRecordCount, toStringMethods inherited from class com.northconcepts.datapipeline.core.Endpoint
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
-
Constructor Details
-
DataWriter
public DataWriter()
-
-
Method Details
-
getNestedEndpoint
Description copied from class:EndpointReturns theEndpointheld inside this one ornullif there isn't one.- Overrides:
getNestedEndpointin classDataEndpoint
-
getRootEndpoint
Description copied from class:EndpointReturns the deepest, nestedEndpointheld inside this one, otherwise this instance is returned if there aren't any nestedEndpoints.- Overrides:
getRootEndpointin classDataEndpoint
-
getNestedWriter
Returns theDataWriterheld inside this one ornullif there isn't one. -
getWriter
Returns the firstDataWriterof the specified type held inside this one ornullif there isn't one. -
getRootWriter
Returns the deepest, nestedDataWriterheld inside this one, otherwise this instance is returned if there aren't any nestedDataWriters. -
available
Returns the number of records that can probably be written without blocking.- Throws:
DataException
-
writeImpl
Overridden by subclasses to write the specified record to thisDataWriter.Contract for subclasses (see also
docs/authoring/DataWriter.md):- Do not call this method directly —
write(Record)is the template method that wraps exceptions, increments the record count, and attaches the offending record to thrownDataExceptions. - Do not call
DataEndpoint.incrementRecordCount()here;write(Record)already does. - Throw raw exceptions;
write(Record)wraps them viaexception(throwable).setRecord(record).
- Throws:
Throwable
- Do not call this method directly —
-
write
Writes the specified record to thisDataWriterand increases the record-count by 1. Any exception raised while writing will be converted to aDataExceptionusingDataObject.exception(Throwable).Subclasses generally do not need to override this method, instead they should implement
writeImpl(Record).- Throws:
DataException
-
addExceptionProperties
Description copied from class:EndpointAdds this endpoint's current state to aDataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.- Overrides:
addExceptionPropertiesin classDataEndpoint
-