Class SimpleDataImportStreamProcessor
java.lang.Object
com.illumon.iris.db.tables.dataimport.logtailer.DataImportProcessorBaseImpl
com.illumon.iris.db.tables.dataimport.logtailer.DataImportStreamProcessor
com.illumon.iris.db.tables.dataimport.logtailer.SimpleDataImportStreamProcessor
- All Implemented Interfaces:
DataImportProcessorBase
,ProcessDataLocker
public class SimpleDataImportStreamProcessor
extends DataImportStreamProcessor
implements ProcessDataLocker
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
An object defined by the caller, capable of fulfillingreject(String, Exception)
Nested classes/interfaces inherited from class com.illumon.iris.db.tables.dataimport.logtailer.DataImportStreamProcessor
DataImportStreamProcessor.Context
-
Field Summary
Fields inherited from class com.illumon.iris.db.tables.dataimport.logtailer.DataImportProcessorBaseImpl
CHECKPOINT_INTERVAL_MILLIS_SUFFIX, dataStreamProcessorDirectory, DISP_DEFAULT_PREFIX, DISP_PREFIX, FLUSH_INTERVAL_SUFFIX, log, logPrefix, MAX_SHUTDOWN_DELAY_MILLIS_SUFFIX, PROFILING_LEVEL_SUFFIX, schemaService
-
Method Summary
Modifier and TypeMethodDescriptionprotected Boolean
Test "liveness" for this stream processor.void
protected String
make
(com.fishlib.io.sched.Scheduler scheduler, com.fishlib.configuration.Configuration configuration, com.fishlib.io.logger.Logger log, String description, FullTableLocationKey streamKey, com.illumon.iris.db.tables.dataimport.logtailer.DataImportStreamProcessor.Directory streamProcessorDirectory, LocalTableDataService tableDataService, StringCacheProvider stringCacheProvider, SchemaService schemaService, Runnable closeCallback, SimpleDataImportStreamProcessor.OnReject onReject) Factory method to create a new SimpleDataImportStreamProcessorprotected boolean
void
processData
(Runnable runnable) Call this with your runnable that processes data and writes to the table to ensure proper locking around the checkpointing and flushing.protected void
void
runWhenConsistent
(Runnable runnable) Wait for the update counter to be consistent, and then run the given function.Prevent checkpoints from being written until the returned Closeable is closed.Methods inherited from class com.illumon.iris.db.tables.dataimport.logtailer.DataImportStreamProcessor
addPostCommitCallback, addPostPrepareCallback, initialize, shutdown, toString
Methods inherited from class com.illumon.iris.db.tables.dataimport.logtailer.DataImportProcessorBaseImpl
getLog, getLogPrefix
-
Method Details
-
make
public static SimpleDataImportStreamProcessor make(@NotNull com.fishlib.io.sched.Scheduler scheduler, @NotNull com.fishlib.configuration.Configuration configuration, @NotNull com.fishlib.io.logger.Logger log, @NotNull String description, @NotNull FullTableLocationKey streamKey, @NotNull com.illumon.iris.db.tables.dataimport.logtailer.DataImportStreamProcessor.Directory streamProcessorDirectory, @NotNull LocalTableDataService tableDataService, @NotNull StringCacheProvider stringCacheProvider, @NotNull SchemaService schemaService, @NotNull Runnable closeCallback, @NotNull SimpleDataImportStreamProcessor.OnReject onReject) Factory method to create a new SimpleDataImportStreamProcessor- Parameters:
scheduler
- The scheduler for the flush and commit tasksconfiguration
- the configuration to uselog
- The logdescription
- description of the data connectionstreamKey
- Destination informationstreamProcessorDirectory
- An object to lookup Processors based on table key.tableDataService
- The table data servicestringCacheProvider
- The string cache providerschemaService
- The schemaServicecloseCallback
- callback to be invoked when the simple data stream is closedonReject
- callback to be invoked if the simple data stream is rejected- Returns:
- a new SimpleDataImportStreamProcessor
-
processData
Call this with your runnable that processes data and writes to the table to ensure proper locking around the checkpointing and flushing.- Specified by:
processData
in interfaceProcessDataLocker
- Parameters:
runnable
- a runnable that processes data for this stream
-
onInitialization
protected boolean onInitialization() -
close
-
checkLiveness
Description copied from class:DataImportStreamProcessor
Test "liveness" for this stream processor. checkLiveness will return one of three values:- true - the current connection is known to be live - the heartbeat succeeded
- false - the current connection is dead - the heartbeat attempt threw an exception and the current channel has already been closed, or the liveness check timed out and the connection was killed
- null - the connection state is unknown - e.g. the heartbeat timed out the connection could not be killed
- Specified by:
checkLiveness
in classDataImportStreamProcessor
- Returns:
- True if alive, false if not, null if uncertain
-
getDescription
-
reject
-
suspendCheckpointing
Prevent checkpoints from being written until the returned Closeable is closed.Note: If you do not close the returned value; then data is never made durable.
- Returns:
- a Closeable object that resumes checkpoint processing.
-
runWhenConsistent
Wait for the update counter to be consistent, and then run the given function.- Parameters:
runnable
- the runnable to execute under the processing lock; while the state is consistent
-