Pipeline

open class Pipeline<TSubject : Any, TContext : Any>

Represents an execution pipeline for asynchronous extensible computations

Constructors

<init>

Pipeline(
    phase: PipelinePhase,
    interceptors: List<PipelineInterceptor<TSubject, TContext>>)
Pipeline(vararg phases: PipelinePhase)

Represents an execution pipeline for asynchronous extensible computations

Properties

attributes

val attributes: Attributes

Provides common place to store pipeline attributes

isEmpty

val isEmpty: Boolean

items

val items: List<PipelinePhase>

Phases of this pipeline

Functions

addPhase

fun addPhase(phase: PipelinePhase): Unit

Adds phase to the end of this pipeline

afterIntercepted

open fun afterIntercepted(): Unit

Invoked after an interceptor has been installed

execute

suspend fun execute(
    context: TContext,
    subject: TSubject
): TSubject

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

insertPhaseAfter

fun insertPhaseAfter(
    reference: PipelinePhase,
    phase: PipelinePhase
): Unit

Inserts phase after the reference phase

insertPhaseBefore

fun insertPhaseBefore(
    reference: PipelinePhase,
    phase: PipelinePhase
): Unit

Inserts phase before the reference phase

intercept

fun intercept(
    phase: PipelinePhase,
    block: PipelineInterceptor<TSubject, TContext>
): Unit

Adds block to the phase of this pipeline

merge

fun merge(from: Pipeline<TSubject, TContext>): Unit

Merges another pipeline into this pipeline, maintaining relative phases order

Extension Functions

execute

suspend fun <TContext : Any> Pipeline<Unit, TContext>.execute(
    context: TContext
): Unit

Executes this pipeline

feature

fun <A : Pipeline<*, ApplicationCall>, B : Any, F : Any> A.feature(
    feature: ApplicationFeature<A, B, F>
): F

Gets feature instance for this pipeline, or fails with MissingApplicationFeatureException if the feature is not installed

featureOrNull

fun <A : Pipeline<*, ApplicationCall>, B : Any, F : Any> A.featureOrNull(
    feature: ApplicationFeature<A, B, F>
): F?

Returns feature instance for this pipeline, or null if feature is not installed

install

fun <P : Pipeline<*, ApplicationCall>, B : Any, F : Any> P.install(
    feature: ApplicationFeature<P, B, F>,
    configure: B.() -> Unit = {}
): F

Installs feature into this pipeline, if it is not yet installed

intercept

fun <TSubject : Any, TContext : Any> Pipeline<*, TContext>.intercept(
    phase: PipelinePhase,
    block: suspend PipelineContext<TSubject, TContext>.(TSubject) -> Unit
): Unit

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

uninstall

fun <A : Pipeline<*, ApplicationCall>, B : Any, F : Any> A.uninstall(
    feature: ApplicationFeature<A, B, F>
): Unit

Uninstalls feature from the pipeline

uninstallAllFeatures

fun <A : Pipeline<*, ApplicationCall>> A.uninstallAllFeatures(): Unit

Uninstalls all features from the pipeline

uninstallFeature

fun <A : Pipeline<*, ApplicationCall>, F : Any> A.uninstallFeature(
    key: AttributeKey<F>
): Unit

Uninstalls feature specified by key from the pipeline

Inheritors

ApplicationCallPipeline

open class ApplicationCallPipeline : 
    Pipeline<Unit, ApplicationCall>

Pipeline configuration for executing ApplicationCall instances

ApplicationReceivePipeline

open class ApplicationReceivePipeline : 
    Pipeline<ApplicationReceiveRequest, ApplicationCall>

Pipeline for processing incoming content

ApplicationSendPipeline

open class ApplicationSendPipeline : 
    Pipeline<Any, ApplicationCall>

Server response send pipeline

AuthenticationPipeline

class AuthenticationPipeline : 
    Pipeline<AuthenticationContext, ApplicationCall>

Represents authentication Pipeline for checking and requesting authentication

EnginePipeline

class EnginePipeline : Pipeline<Unit, ApplicationCall>

Application engine pipeline. One usually don’t need to install interceptors here unless your are writing your own engine implementation

HttpReceivePipeline

class HttpReceivePipeline : 
    Pipeline<HttpResponse, HttpClientCall>

HttpClient Pipeline used for receiving HttpResponse without any processing.

HttpRequestPipeline

class HttpRequestPipeline : Pipeline<Any, HttpRequestBuilder>

HttpClient Pipeline used for executing HttpRequest.

HttpResponsePipeline

class HttpResponsePipeline : 
    Pipeline<HttpResponseContainer, HttpClientCall>

HttpClient Pipeline used for executing HttpResponse.

HttpSendPipeline

class HttpSendPipeline : Pipeline<Any, HttpRequestBuilder>

HttpClient Pipeline used for sending HttpRequest to remote server.