Package tech.illuin.pipeline
Class CompositePipeline<I>
java.lang.Object
tech.illuin.pipeline.CompositePipeline<I>
- All Implemented Interfaces:
AutoCloseable,Pipeline<I>
The CompositePipeline works by separating its run implementation into predefined categories of components:
- 1
Initializerresponsible for creating the pipeline payload, which is reference in theOutputand made available to steps and sinks - 1 to n
Indexerresponsible for identifying parts (or all) of the payload that will be subjected to steps - 0 to n
Stepperforming transformative operations, ideally without external side effects, their output is indexed in theResultContainer - 0 to n
Sinkperforming terminal operations, expected to be external side effects, they can be executed in a synchronous or asynchronous fashion - 0 to 1
PipelineErrorHandlerresponsible for handling and possibly recovering from exceptions occurring during the pipeline's execution - 0 to n
OnCloseHandlerresponsible for cleaning up when tearing down the pipeline
The pipeline references an ExecutorService which the pipeline will attempt to close when its own close() method is called.
It will additionally handle a variety of MeterRegistry counters reflecting the activity of its components.
- Author:
- Pierre Lecerf ([email protected])
-
Constructor Summary
ConstructorsConstructorDescriptionCompositePipeline(String id, UIDGenerator uidGenerator, InitializerDescriptor<I> initializer, AuthorResolver<I> authorResolver, List<Indexer<?>> indexers, OutputFactory<I> outputFactory, List<StepDescriptor<Indexable, I>> steps, List<SinkDescriptor> sinks, Supplier<ExecutorService> sinkExecutorProvider, PipelineErrorHandler errorHandler, int closeTimeout, List<OnCloseHandler> onCloseHandlers, io.micrometer.core.instrument.MeterRegistry meterRegistry, TagResolver<I> tagResolver, List<Observer> observers) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tech.illuin.pipeline.Pipeline
asStep, asStep, newContext, newContext, run, run, run
-
Constructor Details
-
CompositePipeline
public CompositePipeline(String id, UIDGenerator uidGenerator, InitializerDescriptor<I> initializer, AuthorResolver<I> authorResolver, List<Indexer<?>> indexers, OutputFactory<I> outputFactory, List<StepDescriptor<Indexable, I>> steps, List<SinkDescriptor> sinks, Supplier<ExecutorService> sinkExecutorProvider, PipelineErrorHandler errorHandler, int closeTimeout, List<OnCloseHandler> onCloseHandlers, io.micrometer.core.instrument.MeterRegistry meterRegistry, TagResolver<I> tagResolver, List<Observer> observers)
-
-
Method Details
-
id
Description copied from interface:PipelineThe returned identifier should ideally be unique throughout an application. It is used in log entries and by thePipelineContaineras an identity and indexing key. -
run
Description copied from interface:PipelineThe run method is the Pipeline's sole entrypoint, responsible for implementing its behaviour. It returns anOutputwhich is the composition ofResultinstances produced during the run itself, as well as eventual historicalResultretrieved from theContextat initialization.- Specified by:
runin interfacePipeline<I>- Parameters:
input- an input value which can be directly processed byStepor can contribute to the initialization of a payloadcontext- an optionalContextinstance providing information related tu current and eventual previous runs- Returns:
- the Pipeline's output
- Throws:
PipelineException
-
close
-
describe
-