Interface Ingestion<STATE>
-
- Type Parameters:
STATE
- Type defining the state used in the ingestion.
public interface Ingestion<STATE>
Interface that should be implemented by users of task reactor and passed over toIngestionWorker
instance.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
ingestionCancelled(WorkItem workItem, STATE lastState)
This method is invoked in case when the ingestion gets cancelled in the middle of the execution.STATE
initialState(WorkItem workItem)
Used to initialize or load the initial state for the ingestion.boolean
isIngestionCompleted(WorkItem workItem, STATE state)
The worker callsperformIngestion(WorkItem, Object)
as long as the value returned from this method istrue
.STATE
performIngestion(WorkItem workItem, STATE state)
This is where the actual data ingestion should happen.void
postIngestion(WorkItem workItem, STATE state)
Logic that needs to be executed after ingestion ends.void
preIngestion(WorkItem workItem)
Logic that needs to be executed before ingestion begins.
-
-
-
Method Detail
-
initialState
STATE initialState(WorkItem workItem)
Used to initialize or load the initial state for the ingestion. State returned from this method is used in the first call ofperformIngestion(WorkItem, Object)
method.- Parameters:
workItem
- work item provided by the dispatcher- Returns:
- initial ingestion state
-
preIngestion
void preIngestion(WorkItem workItem)
Logic that needs to be executed before ingestion begins.- Parameters:
workItem
- work item provided by the dispatcher
-
performIngestion
STATE performIngestion(WorkItem workItem, STATE state)
This is where the actual data ingestion should happen.- Parameters:
state
- State that was returned from the previousperformIngestion
call, or the initial state if it's the first call of this method.workItem
- work item provided by the dispatcher- Returns:
- new state that will be used as a state argument in the next call of this method
-
isIngestionCompleted
boolean isIngestionCompleted(WorkItem workItem, STATE state)
The worker callsperformIngestion(WorkItem, Object)
as long as the value returned from this method istrue
.Note that
performIngestion(WorkItem, Object)
is called at least once.- Parameters:
workItem
- work item provided by the dispatcherstate
- current ingestion state- Returns:
- whether the ingestion has been completed
-
postIngestion
void postIngestion(WorkItem workItem, STATE state)
Logic that needs to be executed after ingestion ends.Note: this is NOT called when the ingestion gets cancelled.
- Parameters:
workItem
- work item provided by the dispatcherstate
- current ingestion state
-
ingestionCancelled
default void ingestionCancelled(WorkItem workItem, STATE lastState)
This method is invoked in case when the ingestion gets cancelled in the middle of the execution. If that happens,postIngestion(WorkItem, Object)
is NOT called anymore.- Parameters:
workItem
- work item provided by the dispatcherlastState
- The newest state that was returned fromperformIngestion(WorkItem, Object)
orinitialState(WorkItem)
.
-
-