Pipeline

open class Pipeline<TSubject : Any, TContext : Any>(phases: PipelinePhase)

Represents an execution pipeline for asynchronous extensible computations

Constructors

Link copied to clipboard
fun Pipeline(phase: PipelinePhase, interceptors: List<PipelineInterceptor<TSubject, TContext>>)
Link copied to clipboard
fun Pipeline(vararg phases: PipelinePhase)

Functions

Link copied to clipboard
fun addPhase(phase: PipelinePhase)

Adds phase to the end of this pipeline

Link copied to clipboard
open fun afterIntercepted()

Invoked after an interceptor has been installed

Link copied to clipboard
suspend fun execute(context: TContext, subject: TSubject): TSubject

Executes this pipeline in the given context and with the given subject

Link copied to clipboard
fun insertPhaseAfter(reference: PipelinePhase, phase: PipelinePhase)

Inserts phase after the reference phase. If there are other phases inserted after reference, then phase will be inserted after them. Example:

Link copied to clipboard
fun insertPhaseBefore(reference: PipelinePhase, phase: PipelinePhase)

Inserts phase before the reference phase. Example:

Link copied to clipboard
fun intercept(phase: PipelinePhase, block: PipelineInterceptor<TSubject, TContext>)

Adds block to the phase of this pipeline

Link copied to clipboard
fun interceptorsForPhase(phase: PipelinePhase): List<PipelineInterceptor<TSubject, TContext>>
Link copied to clipboard
fun merge(from: Pipeline<TSubject, TContext>)

Merges another pipeline into this pipeline, maintaining relative phases order

Link copied to clipboard
fun mergePhases(from: Pipeline<TSubject, TContext>)
Link copied to clipboard
fun resetFrom(from: Pipeline<TSubject, TContext>)

Reset current pipeline from other.

Properties

Link copied to clipboard
val attributes: Attributes

Provides common place to store pipeline attributes

Link copied to clipboard
open val developmentMode: Boolean = false

Indicated if debug mode is enabled. In debug mode users will get more details in the stacktrace.

Link copied to clipboard
val isEmpty: Boolean
Link copied to clipboard
val items: List<PipelinePhase>

Phases of this pipeline

Extensions

Link copied to clipboard
inline suspend fun <TContext : Any> Pipeline<Unit, TContext>.execute(context: TContext)

Executes this pipeline

Link copied to clipboard
inline fun <TSubject : Any, TContext : Any> Pipeline<*, TContext>.intercept(phase: PipelinePhase, noinline block: suspend PipelineContext<TSubject, TContext>.(TSubject) -> Unit)

Intercepts an untyped pipeline when the subject is of the given type