akka.stream.actor

ActorProducer

trait ActorProducer[T] extends Actor

Extend/mixin this trait in your akka.actor.Actor to make it a stream producer that keeps track of the subscription life cycle and requested elements.

Create a org.reactivestreams.api.Producer backed by this actor with ActorProducer#apply. It can be attached to a org.reactivestreams.api.Consumer or be used as an input source for a akka.stream.Flow. You can only attach one subscriber to this producer.

The life cycle state of the subscription is tracked with the following boolean members: #isActive, #isCompleted, #isErrorEmitted, and #isCanceled.

You send elements to the stream by calling #onNext. You are allowed to send as many elements as have been requested by the stream consumer. This amount can be inquired with #totalDemand. It is only allowed to use onNext when isActive and totalDemand > 0, otherwise onNext will throw IllegalStateException.

When the stream consumer requests more elements the ActorProducer#Request message is delivered to this actor, and you can act on that event. The #totalDemand is updated automatically.

When the stream consumer cancels the subscription the ActorProducer#Cancel message is delivered to this actor. After that subsequent calls to onNext will be ignored.

You can complete the stream by calling #onComplete. After that you are not allowed to call #onNext, #onError and #onComplete.

You can terminate the stream with failure by calling #onError. After that you are not allowed to call #onNext, #onError and #onComplete.

If the actor is stopped the stream will be completed, unless it was not already terminated with failure, completed or canceled.

Source
ActorProducer.scala
Linear Supertypes
Actor, AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ActorProducer
  2. Actor
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type Receive = PartialFunction[Any, Unit]

    Definition Classes
    Actor

Abstract Value Members

  1. abstract def receive: actor.Actor.Receive

    Definition Classes
    Actor

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from ActorProducer[T] to any2stringadd[ActorProducer[T]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ActorProducer[T], B)

    Implicit information
    This member is added by an implicit conversion from ActorProducer[T] to ArrowAssoc[ActorProducer[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  6. def aroundPostRestart(reason: Throwable): Unit

    Attributes
    protected[akka]
    Definition Classes
    ActorProducer → Actor
  7. def aroundPostStop(): Unit

    Attributes
    protected[akka]
    Definition Classes
    ActorProducer → Actor
  8. def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit

    Attributes
    protected[akka]
    Definition Classes
    ActorProducer → Actor
  9. def aroundPreStart(): Unit

    Attributes
    protected[akka]
    Definition Classes
    Actor
  10. def aroundReceive(receive: Receive, msg: Any): Unit

    Attributes
    protected[akka]
    Definition Classes
    ActorProducer → Actor
  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. implicit val context: ActorContext

    Definition Classes
    Actor
  14. def ensuring(cond: (ActorProducer[T]) ⇒ Boolean, msg: ⇒ Any): ActorProducer[T]

    Implicit information
    This member is added by an implicit conversion from ActorProducer[T] to Ensuring[ActorProducer[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: (ActorProducer[T]) ⇒ Boolean): ActorProducer[T]

    Implicit information
    This member is added by an implicit conversion from ActorProducer[T] to Ensuring[ActorProducer[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean, msg: ⇒ Any): ActorProducer[T]

    Implicit information
    This member is added by an implicit conversion from ActorProducer[T] to Ensuring[ActorProducer[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: Boolean): ActorProducer[T]

    Implicit information
    This member is added by an implicit conversion from ActorProducer[T] to Ensuring[ActorProducer[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  20. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from ActorProducer[T] to StringFormat[ActorProducer[T]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  22. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  24. final def isActive: Boolean

    The state when the producer is active, i.

    The state when the producer is active, i.e. before the subscriber is attached and when an subscriber is attached. It is allowed to call #onComplete and #onError in this state. It is allowed to call #onNext in this state when #totalDemand is greater than zero.

  25. final def isCanceled: Boolean

    The state after the stream consumer has canceled the subscription.

    The state after the stream consumer has canceled the subscription. It is allowed to call #onNext, #onError, and #onComplete in this state, but the calls will not perform anything.

  26. final def isCompleted: Boolean

    The terminal state after calling #onComplete.

    The terminal state after calling #onComplete. It is not allowed to call #onNext, #onError, and #onComplete in this state.

  27. final def isErrorEmitted: Boolean

    The terminal state after calling #onError.

    The terminal state after calling #onError. It is not allowed to call #onNext, #onError, and #onComplete in this state.

  28. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  29. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  30. final def notify(): Unit

    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  32. def onComplete(): Unit

    Complete the stream.

    Complete the stream. After that you are not allowed to call #onNext, #onError and #onComplete.

  33. def onError(cause: Throwable): Unit

    Terminate the stream with failure.

    Terminate the stream with failure. After that you are not allowed to call #onNext, #onError and #onComplete.

  34. def onNext(element: T): Unit

    Send an element to the stream consumer.

    Send an element to the stream consumer. You are allowed to send as many elements as have been requested by the stream consumer. This amount can be inquired with #totalDemand. It is only allowed to use onNext when isActive and totalDemand > 0, otherwise onNext will throw IllegalStateException.

  35. def postRestart(reason: Throwable): Unit

    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  36. def postStop(): Unit

    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  37. def preRestart(reason: Throwable, message: Option[Any]): Unit

    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  38. def preStart(): Unit

    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  39. implicit final val self: ActorRef

    Definition Classes
    Actor
  40. final def sender(): ActorRef

    Definition Classes
    Actor
  41. def supervisorStrategy: SupervisorStrategy

    Definition Classes
    Actor
  42. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  43. def toString(): String

    Definition Classes
    AnyRef → Any
  44. final def totalDemand: Int

    Total number of requested elements from the stream consumer.

    Total number of requested elements from the stream consumer. This actor automatically keeps tracks of this amount based on incoming request messages and outgoing onNext.

  45. def unhandled(message: Any): Unit

    Definition Classes
    Actor
  46. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. def [B](y: B): (ActorProducer[T], B)

    Implicit information
    This member is added by an implicit conversion from ActorProducer[T] to ArrowAssoc[ActorProducer[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from ActorProducer[T] to any2stringadd[ActorProducer[T]]

Inherited by implicit conversion StringFormat from ActorProducer[T] to StringFormat[ActorProducer[T]]

Inherited by implicit conversion Ensuring from ActorProducer[T] to Ensuring[ActorProducer[T]]

Inherited by implicit conversion ArrowAssoc from ActorProducer[T] to ArrowAssoc[ActorProducer[T]]

Ungrouped