Class ActorPublisher<T>
Extend this actor to make it a stream publisher that keeps track of the subscription life cycle and requested elements.
Create a Reactive.Streams.IPublisher<T> backed by this actor with Create<T>(IActorRef).
It can be attached to a Reactive.Streams.ISubscriber<T> or be used as an input source for a IFlow<TOut, TMat>. You can only attach one subscriber to this publisher.
The life cycle state of the subscription is tracked with the following boolean members:
Is
You send elements to the stream by calling On
When the stream subscriber requests more elements the Request message
is delivered to this actor, and you can act on that event. The Total
When the stream subscriber cancels the subscription the Cancel message
is delivered to this actor. After that subsequent calls to On
You can complete the stream by calling On
You can terminate the stream with failure by calling On
If you suspect that this ActorPublisher<T> may never get subscribed to,
you can override the Subscription
If the actor is stopped the stream will be completed, unless it was not already terminated with failure, completed or canceled.
Implements
Inherited Members
Namespace: Akka.Streams.Actors
Assembly: Akka.Streams.dll
Syntax
public abstract class ActorPublisher<T> : ActorBase, IInternalActor
Type Parameters
Name | Description |
---|---|
T | TBD |
Constructors
| Improve this Doc View SourceActorPublisher()
TBD
Declaration
protected ActorPublisher()
Properties
| Improve this Doc View SourceIsActive
The state when the publisher is active, i.e. before the subscriber is attached
and when an subscriber is attached. It is allowed to
call On
Declaration
public bool IsActive { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsCanceled
The state after the stream subscriber has canceled the subscription.
It is allowed to call On
Declaration
public bool IsCanceled { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsCompleted
The terminal state after calling On
Declaration
public bool IsCompleted { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsErrorEmitted
The terminal state after calling On
Declaration
public bool IsErrorEmitted { get; }
Property Value
Type | Description |
---|---|
Boolean |
SubscriptionTimeout
Subscription timeout after which this actor will become Canceled and reject any incoming "late" subscriber.
The actor will receive an Subscription
Use this feature in order to avoid leaking actors when you suspect that this Publisher may never get subscribed to by some Subscriber.
Declaration
public TimeSpan SubscriptionTimeout { get; protected set; }
Property Value
Type | Description |
---|---|
Time |
TotalDemand
Total number of requested elements from the stream subscriber.
This actor automatically keeps tracks of this amount based on
incoming request messages and outgoing On
Declaration
public long TotalDemand { get; }
Property Value
Type | Description |
---|---|
Int64 |
Methods
| Improve this Doc View SourceAroundPostRestart(Exception, Object)
TBD
Declaration
public override void AroundPostRestart(Exception cause, object message)
Parameters
Overrides
| Improve this Doc View SourceAroundPostStop()
TBD
Declaration
public override void AroundPostStop()
Overrides
| Improve this Doc View SourceAroundPreRestart(Exception, Object)
TBD
Declaration
public override void AroundPreRestart(Exception cause, object message)
Parameters
Overrides
| Improve this Doc View SourceAroundPreStart()
TBD
Declaration
public override void AroundPreStart()
Overrides
| Improve this Doc View SourceAroundReceive(Receive, Object)
TBD
Declaration
protected override bool AroundReceive(Receive receive, object message)
Parameters
Returns
Type | Description |
---|---|
Boolean | TBD |
Overrides
| Improve this Doc View SourceOnComplete()
Complete the stream. After that you are not allowed to
call On
Declaration
public void OnComplete()
Exceptions
Type | Condition |
---|---|
Illegal |
This exception is thrown for a number of reasons. These include:
|
OnCompleteThenStop()
Complete the stream. After that you are not allowed to
call On
After signalling completion the Actor will then stop itself as it has completed the protocol.
When On
Declaration
public void OnCompleteThenStop()
OnError(Exception)
Terminate the stream with failure. After that you are not allowed to
call On
Declaration
public void OnError(Exception cause)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | TBD |
Exceptions
Type | Condition |
---|---|
Illegal |
This exception is thrown for a number of reasons. These include:
|
OnErrorThenStop(Exception)
Terminate the stream with failure. After that you are not allowed to
call On
After signalling the Error the Actor will then stop itself as it has completed the protocol.
When On
Declaration
public void OnErrorThenStop(Exception cause)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | TBD |
OnNext(T)
Sends an element to the stream subscriber. You are allowed to send as many elements
as have been requested by the stream subscriber. This amount can be inquired with
Total
Declaration
public void OnNext(T element)
Parameters
Type | Name | Description |
---|---|---|
T | element | TBD |
Exceptions
Type | Condition |
---|---|
Illegal |
This exception is thrown for a number of reasons. These include:
|