Class AbstractStage<TIn, TOut>
TBD
Inheritance
Implements
Inherited Members
Namespace: Akka.Streams.Stage
Assembly: Akka.Streams.dll
Syntax
[Obsolete("Please use GraphStage instead. [1.1.2]")]
public abstract class AbstractStage<TIn, TOut> : IStage<TIn, TOut>
Type Parameters
Name | Description |
---|---|
TIn | TBD |
TOut | TBD |
Properties
| Improve this Doc View SourceIsDetached
TBD
Declaration
protected virtual bool IsDetached { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceDecide(Exception)
If an exception is thrown from OnPush(TIn, IContext) this method is invoked to decide how to handle the exception. By default this method returns Stop.
If an exception is thrown from OnPull(IContext) the stream will always be completed with failure, because it is not always possible to recover from that state. In concrete stages it is of course possible to use ordinary try-catch-recover inside OnPull(IContext) when it is know how to recover from such exceptions.
Declaration
public virtual Directive Decide(Exception cause)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | TBD |
Returns
Type | Description |
---|---|
Directive | TBD |
OnDownstreamFinish(IContext, Exception)
This method is called when downstream has cancelled. By default the cancel signal is immediately propagated with Akka.Streams.Stage.StatefulStage.Finish.
Declaration
public abstract ITerminationDirective OnDownstreamFinish(IContext context, Exception cause)
Parameters
Type | Name | Description |
---|---|---|
IContext | context | TBD |
Exception | cause |
Returns
Type | Description |
---|---|
ITerminationDirective | TBD |
OnPull(IContext)
This method is called when there is demand from downstream, i.e. you are allowed to push one element downstreams with Push(Object), or request elements from upstreams with Pull()
Declaration
public abstract IDirective OnPull(IContext context)
Parameters
Type | Name | Description |
---|---|---|
IContext | context | TBD |
Returns
Type | Description |
---|---|
IDirective | TBD |
OnPush(TIn, IContext)
This method is called when an element from upstream is available and there is demand from downstream, i.e. in OnPush(TIn, IContext) you are allowed to call Push(Object) to emit one element downstreams, or you can absorb the element by calling Pull(). Note that you can only emit zero or one element downstream from OnPull(IContext).
To emit more than one element you have to push the remaining elements from OnPull(IContext), one-by-one. OnPush(TIn, IContext) is not called again until OnPull(IContext) has requested more elements with Pull().
Declaration
public abstract IDirective OnPush(TIn element, IContext context)
Parameters
Type | Name | Description |
---|---|---|
TIn | element | TBD |
IContext | context | TBD |
Returns
Type | Description |
---|---|
IDirective | TBD |
OnUpstreamFailure(Exception, IContext)
OnUpstreamFailure(Exception, IContext) is called when upstream has signaled that the stream is completed with failure. It is not called if OnPull(IContext) or OnPush(TIn, IContext) of the stage itself throws an exception.
Note that elements that were emitted by upstream before the failure happened might not have been received by this stage when OnUpstreamFailure(Exception, IContext) is called, i.e. failures are not backpressured and might be propagated as soon as possible.
Here you cannot call Push(Object), because there might not be any demand from downstream. To emit additional elements before terminating you can use AbsorbTermination() and push final elements from OnPull(IContext). The stage will then be in finishing state, which can be checked with IsFinishing.
Declaration
public abstract ITerminationDirective OnUpstreamFailure(Exception cause, IContext context)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | TBD |
IContext | context | TBD |
Returns
Type | Description |
---|---|
ITerminationDirective | TBD |
OnUpstreamFinish(IContext)
This method is called when upstream has signaled that the stream is successfully completed. Here you cannot call Push(Object), because there might not be any demand from downstream. To emit additional elements before terminating you can use AbsorbTermination() and push final elements from OnPull(IContext). The stage will then be in finishing state, which can be checked with IsFinishing.
By default the finish signal is immediately propagated with Akka.Streams.Stage.StatefulStage.Finish.
IMPORTANT NOTICE: this signal is not back-pressured, it might arrive from upstream even though the last action by this stage was a "push".
Declaration
public abstract ITerminationDirective OnUpstreamFinish(IContext context)
Parameters
Type | Name | Description |
---|---|---|
IContext | context | TBD |
Returns
Type | Description |
---|---|
ITerminationDirective | TBD |
PostStop()
User overridable callback.
Is called after the Stages final action is performed.
Empty default implementation.
Declaration
public virtual void PostStop()
PreStart(ILifecycleContext)
User overridable callback.
It is called before any other method defined on the IStage<TIn, TOut>. Empty default implementation.
Declaration
public virtual void PreStart(ILifecycleContext context)
Parameters
Type | Name | Description |
---|---|---|
ILifecycleContext | context | TBD |
Restart()
Used to create a fresh instance of the stage after an error resulting in a Restart directive. By default it will return the same instance untouched, so you must override it if there are any state that should be cleared before restarting, e.g. by returning a new instance.
Declaration
public virtual IStage<TIn, TOut> Restart()
Returns
Type | Description |
---|---|
IStage<TIn, TOut> | TBD |