Class PipelineBuilder
java.lang.Object
io.aleph0.yap.core.build.PipelineBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<InputT> ConsumerTaskBuilder<InputT, NoMetrics> addConsumer(String id, ConsumerWorker<InputT> worker) Add a consumer task to the pipeline.<InputT,MetricsT>
ConsumerTaskBuilder<InputT, MetricsT> addConsumer(String id, ConsumerWorkerFactory<InputT, MetricsT> workerFactory) Add a consumer task to the pipeline.<InputT,MetricsT>
ConsumerTaskBuilder<InputT, MetricsT> addConsumer(String id, MeasuredConsumerWorker<InputT, MetricsT> worker) Add a consumer task to the pipeline.<InputT,OutputT>
ProcessorTaskBuilder<InputT, OutputT, NoMetrics> addProcessor(String id, ProcessorWorker<InputT, OutputT> worker) Add a processor task to the pipeline.<InputT,OutputT, MetricsT>
ProcessorTaskBuilder<InputT, OutputT, MetricsT> addProcessor(String id, MeasuredProcessorWorker<InputT, OutputT, MetricsT> worker) Add a processor task to the pipeline.<InputT,OutputT, MetricsT>
ProcessorTaskBuilder<InputT, OutputT, MetricsT> addProcessor(String id, ProcessorWorkerFactory<InputT, OutputT, MetricsT> workerFactory) Add a processor task to the pipeline.<OutputT> ProducerTaskBuilder<OutputT, NoMetrics> addProducer(String id, ProducerWorker<OutputT> worker) Add a producer task to the pipeline.<OutputT,MetricsT>
ProducerTaskBuilder<OutputT, MetricsT> addProducer(String id, MeasuredProducerWorker<OutputT, MetricsT> worker) Add a producer task to the pipeline.<OutputT,MetricsT>
ProducerTaskBuilder<OutputT, MetricsT> addProducer(String id, ProducerWorkerFactory<OutputT, MetricsT> workerFactory) Add a producer task to the pipeline.addWrapper(PipelineWrapper wrapper) build()Future<?> static ExecutorServiceA reasonableExecutorServicefor running pipeline tasks using platform threads.static ExecutorServiceA reasonableExecutorServicefor running pipeline tasks using virtual threads.setExecutor(ExecutorService executor) setPipelineController(PipelineControllerBuilder controller)
-
Constructor Details
-
PipelineBuilder
public PipelineBuilder()
-
-
Method Details
-
defaultVirtualThreadExecutorService
A reasonableExecutorServicefor running pipeline tasks using virtual threads. This will cause each thread to run in its own virtual thread.This is the default for all new
PipelineBuilderinstances. -
defaultPlatformThreadExecutorService
A reasonableExecutorServicefor running pipeline tasks using platform threads. This will cause each thread to run in its own platform thread.This service has the benefit of naming individual threads reasonably, which allows for easier debugging and profiling.
-
setExecutor
-
setPipelineController
-
addProducer
public <OutputT> ProducerTaskBuilder<OutputT,NoMetrics> addProducer(String id, ProducerWorker<OutputT> worker) Add a producer task to the pipeline. The producer task will only support a single worker, which is the given worker. If theTaskControllerattempts to scale the task beyond one worker, then the task will fail with anIllegalStateException.- Type Parameters:
OutputT- the type of the producer's output- Parameters:
id- the task IDworker- the producer worker- Returns:
- a
ProducerTaskBuilderto configure the producer task - See Also:
-
addProducer
public <OutputT,MetricsT> ProducerTaskBuilder<OutputT,MetricsT> addProducer(String id, MeasuredProducerWorker<OutputT, MetricsT> worker) Add a producer task to the pipeline. The producer task will only support a single worker, which is the given worker. If theTaskControllerattempts to scale the task beyond one worker, then the task will fail with anIllegalStateException.- Type Parameters:
OutputT- the type of the producer's outputMetricsT- the type of the producer's metrics- Parameters:
id- the task IDworker- the producer worker- Returns:
- a
ProducerTaskBuilderto configure the producer task - See Also:
-
addProducer
public <OutputT,MetricsT> ProducerTaskBuilder<OutputT,MetricsT> addProducer(String id, ProducerWorkerFactory<OutputT, MetricsT> workerFactory) Add a producer task to the pipeline. The givenworkerFactorywill be used to create new workers for the task as requested by theTaskController.- Type Parameters:
OutputT- the type of the producer's outputMetricsT- the type of the producer's metrics- Parameters:
id- the task IDworkerFactory- the producer worker factory- Returns:
- a
ProducerTaskBuilderto configure the producer task - See Also:
-
addProcessor
public <InputT,OutputT> ProcessorTaskBuilder<InputT,OutputT, addProcessorNoMetrics> (String id, ProcessorWorker<InputT, OutputT> worker) Add a processor task to the pipeline. The processor task will only support a single worker, which is the given worker. If theTaskControllerattempts to scale the task beyond one worker, then the task will fail with anIllegalStateException.- Type Parameters:
InputT- the type of the processor's inputOutputT- the type of the processor's output- Parameters:
id- the task IDworker- the processor worker- Returns:
- a
ProcessorTaskBuilderto configure the processor task - See Also:
-
addProcessor
public <InputT,OutputT, ProcessorTaskBuilder<InputT,MetricsT> OutputT, addProcessorMetricsT> (String id, MeasuredProcessorWorker<InputT, OutputT, MetricsT> worker) Add a processor task to the pipeline. The processor task will only support a single worker, which is the given worker. If theTaskControllerattempts to scale the task beyond one worker, then the task will fail with anIllegalStateException.- Type Parameters:
InputT- the type of the processor's inputOutputT- the type of the processor's outputMetricsT- the type of the processor's metrics- Parameters:
id- the task IDworker- the processor worker- Returns:
- a
ProcessorTaskBuilderto configure the processor task - See Also:
-
addProcessor
public <InputT,OutputT, ProcessorTaskBuilder<InputT,MetricsT> OutputT, addProcessorMetricsT> (String id, ProcessorWorkerFactory<InputT, OutputT, MetricsT> workerFactory) Add a processor task to the pipeline. The givenworkerFactorywill be used to create new workers for the task as requested by theTaskController.- Type Parameters:
InputT- the type of the processor's inputOutputT- the type of the processor's outputMetricsT- the type of the processor's metrics- Parameters:
id- the task IDworkerFactory- the processor worker factory- Returns:
- a
ProcessorTaskBuilderto configure the processor task - See Also:
-
addConsumer
public <InputT> ConsumerTaskBuilder<InputT,NoMetrics> addConsumer(String id, ConsumerWorker<InputT> worker) Add a consumer task to the pipeline. The consumer task will only support a single worker, which is the given worker. If theTaskControllerattempts to scale the task beyond one worker, then the task will fail with anIllegalStateException.- Type Parameters:
InputT- the type of the consumer's input- Parameters:
id- the task IDworker- the consumer worker- Returns:
- a
ConsumerTaskBuilderto configure the consumer task - See Also:
-
addConsumer
public <InputT,MetricsT> ConsumerTaskBuilder<InputT,MetricsT> addConsumer(String id, MeasuredConsumerWorker<InputT, MetricsT> worker) Add a consumer task to the pipeline. The consumer task will only support a single worker, which is the given worker. If theTaskControllerattempts to scale the task beyond one worker, then the task will fail with anIllegalStateException.- Type Parameters:
InputT- the type of the consumer's inputMetricsT- the type of the consumer's metrics- Parameters:
id- the task IDworker- the consumer worker- Returns:
- a
ConsumerTaskBuilderto configure the consumer task - See Also:
-
addConsumer
public <InputT,MetricsT> ConsumerTaskBuilder<InputT,MetricsT> addConsumer(String id, ConsumerWorkerFactory<InputT, MetricsT> workerFactory) Add a consumer task to the pipeline. The givenworkerFactorywill be used to create new workers for the task as requested by theTaskController.- Type Parameters:
InputT- the type of the consumer's inputMetricsT- the type of the consumer's metrics- Parameters:
id- the task IDworkerFactory- the consumer worker factory- Returns:
- a
ConsumerTaskBuilderto configure the consumer task - See Also:
-
addWrapper
-
addLifecycleListener
-
build
-
buildAndStart
-
buildAndStartAsFuture
-
buildAndStartAsCompletableFuture
-