Class StatefulStage<TIn, TOut>
StatefulStage<TIn, TOut> is a PushPullStage<TIn, TOut> that provides convenience to make some things easier.
The behavior is defined in StageState<TIn, TOut> instances. The initial behavior is specified by subclass implementing the Initial method. The behavior can be changed by using Become(StageState<TIn, TOut>).
Use Emit(IEnumerator<TOut>, IContext<TOut>, StageState<TIn, TOut>) or EmitAndFinish(IEnumerator<TOut>, IContext<TOut>) to push more than one element from OnPush(TIn, IContext<TOut>) or OnPull(IContext<TOut>).
Use TerminationEmit(IEnumerator<TOut>, IContext<TOut>) to push final elements from OnUpstreamFinish(IContext<TOut>) or OnUpstreamFailure(Exception, IContext).
Implements
Inherited Members
Namespace: Akka.Streams.Stage
Assembly: Akka.Streams.dll
Syntax
[Obsolete("Please use GraphStage instead. [1.1.0]")]
public abstract class StatefulStage<TIn, TOut> : PushPullStage<TIn, TOut>, IStage<TIn, TOut>
Type Parameters
Name | Description |
---|---|
TIn | TBD |
TOut | TBD |
Constructors
| Improve this Doc View SourceStatefulStage(StageState<TIn, TOut>)
TBD
Declaration
protected StatefulStage(StageState<TIn, TOut> current)
Parameters
Type | Name | Description |
---|---|---|
StageState<TIn, TOut> | current | TBD |
Properties
| Improve this Doc View SourceCurrent
Current state.
Declaration
public StageState<TIn, TOut> Current { get; }
Property Value
Type | Description |
---|---|
StageState<TIn, TOut> |
Initial
Concrete subclass must return the initial behavior from this method.
Warning: This method must not be implemented as val
.
Declaration
public abstract StageState<TIn, TOut> Initial { get; }
Property Value
Type | Description |
---|---|
StageState<TIn, TOut> |
Methods
| Improve this Doc View SourceBecome(StageState<TIn, TOut>)
Change the behavior to another StageState<TIn, TOut>.
Declaration
public void Become(StageState<TIn, TOut> state)
Parameters
Type | Name | Description |
---|---|---|
StageState<TIn, TOut> | state | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | This exception is thrown when the specified |
Emit(IEnumerator<TOut>, IContext<TOut>)
Can be used from OnPush(TIn, IContext<TOut>) or OnPull(IContext<TOut>) to push more than one element downstream.
Declaration
public ISyncDirective Emit(IEnumerator<TOut> enumerator, IContext<TOut> context)
Parameters
Type | Name | Description |
---|---|---|
IEnumerator<TOut> | enumerator | TBD |
IContext<TOut> | context | TBD |
Returns
Type | Description |
---|---|
ISyncDirective | TBD |
Emit(IEnumerator<TOut>, IContext<TOut>, StageState<TIn, TOut>)
Can be used from OnPush(TIn, IContext<TOut>) or OnPull(IContext<TOut>) to push more than one element downstream and after that change behavior.
Declaration
public ISyncDirective Emit(IEnumerator<TOut> enumerator, IContext<TOut> context, StageState<TIn, TOut> nextState)
Parameters
Type | Name | Description |
---|---|---|
IEnumerator<TOut> | enumerator | TBD |
IContext<TOut> | context | TBD |
StageState<TIn, TOut> | nextState | TBD |
Returns
Type | Description |
---|---|
ISyncDirective | TBD |
Exceptions
Type | Condition |
---|---|
IllegalStateException | This exception is thrown when either currently in the emitting state or the specified |
EmitAndFinish(IEnumerator<TOut>, IContext<TOut>)
Can be used from OnPush(TIn, IContext<TOut>) or OnPull(IContext<TOut>) to push more than one element downstream and after that finish (complete downstream, cancel upstreams).
Declaration
public ISyncDirective EmitAndFinish(IEnumerator<TOut> enumerator, IContext<TOut> context)
Parameters
Type | Name | Description |
---|---|---|
IEnumerator<TOut> | enumerator | TBD |
IContext<TOut> | context | TBD |
Returns
Type | Description |
---|---|
ISyncDirective | TBD |
Exceptions
Type | Condition |
---|---|
IllegalStateException | This exception is thrown when either currently in the emitting state or the specified |
OnPull(IContext<TOut>)
Invokes current state.
Declaration
public sealed override ISyncDirective OnPull(IContext<TOut> context)
Parameters
Type | Name | Description |
---|---|---|
IContext<TOut> | context | TBD |
Returns
Type | Description |
---|---|
ISyncDirective | TBD |
Overrides
OnPush(TIn, IContext<TOut>)
Invokes current state.
Declaration
public sealed override ISyncDirective OnPush(TIn element, IContext<TOut> context)
Parameters
Type | Name | Description |
---|---|---|
TIn | element | TBD |
IContext<TOut> | context | TBD |
Returns
Type | Description |
---|---|
ISyncDirective | TBD |
Overrides
OnUpstreamFinish(IContext<TOut>)
TBD
Declaration
public override ITerminationDirective OnUpstreamFinish(IContext<TOut> context)
Parameters
Type | Name | Description |
---|---|---|
IContext<TOut> | context | TBD |
Returns
Type | Description |
---|---|
ITerminationDirective | TBD |
Overrides
TerminationEmit(IEnumerator<TOut>, IContext<TOut>)
Can be used from OnUpstreamFinish(IContext<TOut>) to push final elements downstream before completing the stream successfully. Note that if this is used from OnUpstreamFailure(Exception, IContext) the failure will be absorbed and the stream will be completed successfully.
Declaration
public ISyncDirective TerminationEmit(IEnumerator<TOut> enumerator, IContext<TOut> context)
Parameters
Type | Name | Description |
---|---|---|
IEnumerator<TOut> | enumerator | TBD |
IContext<TOut> | context | TBD |
Returns
Type | Description |
---|---|
ISyncDirective | TBD |
Exceptions
Type | Condition |
---|---|
IllegalStateException | This exception is thrown when the specified |