Class SplitWriter
java.lang.Object
com.northconcepts.datapipeline.core.DataObject
com.northconcepts.datapipeline.core.Endpoint
com.northconcepts.datapipeline.core.DataEndpoint
com.northconcepts.datapipeline.core.DataWriter
com.northconcepts.datapipeline.multiplex.SplitWriter
Converts a single source DataReader into many downstream sources using one of the provided strategies.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceStrategy for distributing the records written to aSplitWriteramong the readers it created.static enumThe built-in strategies: send every record to all readers or each record to one reader in turn.Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected static final Recordstatic final LoggerFields 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, name, TIMESTAMP_FORMAT -
Constructor Summary
ConstructorsConstructorDescriptionCreates a splitter using theSplitWriter.Strategy.BROADCASTstrategy.SplitWriter(SplitWriter.IStrategy strategy) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Indicates that this endpoint has finished reading or writing.Creates a reader that receives the written records according to the strategy; create all readers before writing so none miss records.intRetrieves the buffer size for downstream readers of this splitter (default is 100 records).Returns the readers created bycreateReader(), which receive the records written to this splitter.voidopen()Makes this endpoint ready for reading or writing.voidDrops closed readers fromgetTargets(); the round-robin strategy calls it when it reaches a closed reader.setQueueSize(int queueSize) Sets the buffer size for downstream readers of this splitter (default is 100 records).protected voidOverridden by subclasses to write the specified record to thisDataWriter.Methods inherited from class com.northconcepts.datapipeline.core.DataWriter
addExceptionProperties, available, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter, getWriter, writeMethods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, 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
-
Field Details
-
log
public static final Logger log -
DEFAULT_QUEUE_SIZE
public static final int DEFAULT_QUEUE_SIZE- See Also:
-
EOF
-
-
Constructor Details
-
SplitWriter
-
SplitWriter
public SplitWriter()Creates a splitter using theSplitWriter.Strategy.BROADCASTstrategy.
-
-
Method Details
-
getStrategy
-
getTargets
Returns the readers created bycreateReader(), which receive the records written to this splitter. -
getQueueSize
public int getQueueSize()Retrieves the buffer size for downstream readers of this splitter (default is 100 records). -
setQueueSize
Sets the buffer size for downstream readers of this splitter (default is 100 records). -
createReader
Creates a reader that receives the written records according to the strategy; create all readers before writing so none miss records. The reader's queue size is fixed at creation, so callsetQueueSize(int)first. -
writeImpl
Description copied from class:DataWriterOverridden by subclasses to write the specified record to thisDataWriter.Contract for subclasses (see also
docs/authoring/DataWriter.md):- Do not call this method directly —
DataWriter.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;DataWriter.write(Record)already does. - Throw raw exceptions;
DataWriter.write(Record)wraps them viaexception(throwable).setRecord(record).
- Specified by:
writeImplin classDataWriter- Throws:
Throwable
- Do not call this method directly —
-
open
Description copied from class:DataEndpointMakes this endpoint ready for reading or writing.- Overrides:
openin classDataEndpoint- Throws:
DataException
-
close
Description copied from class:DataEndpointIndicates that this endpoint has finished reading or writing.- Overrides:
closein classDataEndpoint- Throws:
DataException
-
removeClosedTargets
public void removeClosedTargets()Drops closed readers fromgetTargets(); the round-robin strategy calls it when it reaches a closed reader.
-