Extend this actor to make it a stream publisher that keeps track of the subscription life cycle and requested elements.
Create a CreateT(IActorRef).backed by this actor with
It can be attached to a IFlowTOut, TMat. You can only attach one subscriber to this publisher.or be used as an input source for a
You send elements to the stream by calling OnNext(T). You are allowed to send as many elements as have been requested by the stream subscriber. This amount can be inquired with TotalDemand. It is only allowed to use OnNext(T) when IsActiveTotalDemand > 0, otherwise OnNext(T) will throw IllegalStateException.
If you suspect that this ActorPublisherT may never get subscribed to, you can override the SubscriptionTimeout method to provide a timeout after which this Publisher should be considered canceled. The actor will be notified when the timeout triggers via an SubscriptionTimeoutExceeded message and MUST then perform cleanup and stop itself.
If the actor is stopped the stream will be completed, unless it was not already terminated with failure, completed or canceled.
Extend this actor to make it a stream subscriber with full control of stream back pressure. It will receive OnNext, OnComplete and OnError messages from the stream. It can also receive other, non-stream messages, in the same way as any actor.
Attach the actor as a CreateT(IActorRef)to the stream with
Subclass must define the RequestStrategy to control stream back pressure. After each incoming message the ActorSubscriber will automatically invoke the RequestDemand(Int32) and propagate the returned demand to the stream. The provided WatermarkRequestStrategy is a good strategy if the actor performs work itself. The provided MaxInFlightRequestStrategy is useful if messages are queued internally or delegated to other actors. You can also implement a custom IRequestStrategy or call Request(Int64) manually together with ZeroRequestStrategy or some other strategy. In that case you must also call Request(Int64) when the actor is started or when it is ready, otherwise it will not receive any elements.
This message is delivered to the ActorPublisherT actor when the stream subscriber cancels the subscription.
Requests one more element when remainingRequested is 0, i.e. * max one element in flight.
This message is delivered to the ActorPublisherT actor when the stream subscriber requests more elements.
This message is delivered to the ActorPublisherT actor in order to signal the exceeding of an subscription timeout. Once the actor receives this message, this publisher will already be in cancelled state, thus the actor should clean-up and stop itself.
Requests up to the highWatermark when the remainingRequested is below the lowWatermark. This a good strategy when the actor performs work itself.
When request is only controlled with manual calls to Request(Int64).