Packages

  • package root
    Definition Classes
    root
  • package akka
    Definition Classes
    root
  • package actor
    Definition Classes
    akka
  • package typed
    Definition Classes
    actor
  • package delivery
    Definition Classes
    typed
  • object ProducerController

    Point-to-point reliable delivery between a single producer actor sending messages and a single consumer actor receiving the messages.

    Point-to-point reliable delivery between a single producer actor sending messages and a single consumer actor receiving the messages. Used together with ConsumerController.

    The producer actor will start the flow by sending a ProducerController.Start message to the ProducerController. The ActorRef in the Start message is typically constructed as a message adapter to map the ProducerController.RequestNext to the protocol of the producer actor.

    For the ProducerController to know where to send the messages it must be connected with the ConsumerController. You do this is with ProducerController.RegisterConsumer or ConsumerController.RegisterToProducerController messages.

    The ProducerController sends RequestNext to the producer, which is then allowed to send one message to the ProducerController via the sendNextTo in the RequestNext. Thereafter the producer will receive a new RequestNext when it's allowed to send one more message.

    The producer and ProducerController actors are supposed to be local so that these messages are fast and not lost. This is enforced by a runtime check.

    Many unconfirmed messages can be in flight between the ProducerController and ConsumerController. The flow control is driven by the consumer side, which means that the ProducerController will not send faster than the demand requested by the ConsumerController.

    Lost messages are detected, resent and deduplicated if needed. This is also driven by the consumer side, which means that the ProducerController will not push resends unless requested by the ConsumerController.

    Until sent messages have been confirmed the ProducerController keeps them in memory to be able to resend them. If the JVM of the ProducerController crashes those unconfirmed messages are lost. To make sure the messages can be delivered also in that scenario the ProducerController can be used with a DurableProducerQueue. Then the unconfirmed messages are stored in a durable way so that they can be redelivered when the producer is started again. An implementation of the DurableProducerQueue is provided by EventSourcedProducerQueue in akka-persistence-typed.

    Instead of using tell with the sendNextTo in the RequestNext the producer can use context.ask with the askNextTo in the RequestNext. The difference is that a reply is sent back when the message has been handled. If a DurableProducerQueue is used then the reply is sent when the message has been stored successfully, but it might not have been processed by the consumer yet. Otherwise the reply is sent after the consumer has processed and confirmed the message.

    If the consumer crashes a new ConsumerController can be connected to the original ProducerConsumer without restarting it. The ProducerConsumer will then redeliver all unconfirmed messages.

    It's also possible to use the ProducerController and ConsumerController without resending lost messages, but the flow control is still used. This can for example be useful when both consumer and producer are know to be located in the same local ActorSystem. This can be more efficient since messages don't have to be kept in memory in the ProducerController until they have been confirmed, but the drawback is that lost messages will not be delivered. See configuration only-flow-control of the ConsumerController.

    The producerId is used in logging and included as MDC entry with key "producerId". It's propagated to the ConsumerController and is useful for correlating log messages. It can be any String but it's recommended to use a unique identifier of representing the producer.

    If the DurableProducerQueue is defined it is created as a child actor of the ProducerController actor. It will use the same dispatcher as the parent ProducerController.

    Definition Classes
    delivery
    Annotations
    @ApiMayChange()
  • Command
  • MessageWithConfirmation
  • RegisterConsumer
  • RequestNext
  • Settings
  • Start

final case class RegisterConsumer[A](consumerController: ActorRef[ConsumerController.Command[A]]) extends Command[A] with DeliverySerializable with Product with Serializable

Register the given consumerController to the ProducerController.

Alternatively, this registration can be done on the consumer side with the ConsumerController.RegisterToProducerController message.

When using a custom send function for the ProducerController this should not be used.

Source
ProducerController.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RegisterConsumer
  2. Serializable
  3. Product
  4. Equals
  5. DeliverySerializable
  6. Command
  7. UnsealedInternalCommand
  8. InternalCommand
  9. AnyRef
  10. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new RegisterConsumer(consumerController: ActorRef[ConsumerController.Command[A]])

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
    This member is added by an implicit conversion from RegisterConsumer[A] toany2stringadd[RegisterConsumer[A]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (RegisterConsumer[A], B)
    Implicit
    This member is added by an implicit conversion from RegisterConsumer[A] toArrowAssoc[RegisterConsumer[A]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  8. val consumerController: ActorRef[ConsumerController.Command[A]]
  9. def ensuring(cond: (RegisterConsumer[A]) => Boolean, msg: => Any): RegisterConsumer[A]
    Implicit
    This member is added by an implicit conversion from RegisterConsumer[A] toEnsuring[RegisterConsumer[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (RegisterConsumer[A]) => Boolean): RegisterConsumer[A]
    Implicit
    This member is added by an implicit conversion from RegisterConsumer[A] toEnsuring[RegisterConsumer[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: => Any): RegisterConsumer[A]
    Implicit
    This member is added by an implicit conversion from RegisterConsumer[A] toEnsuring[RegisterConsumer[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): RegisterConsumer[A]
    Implicit
    This member is added by an implicit conversion from RegisterConsumer[A] toEnsuring[RegisterConsumer[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  19. def productElementNames: Iterator[String]
    Definition Classes
    Product
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from RegisterConsumer[A] toStringFormat[RegisterConsumer[A]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  3. def [B](y: B): (RegisterConsumer[A], B)
    Implicit
    This member is added by an implicit conversion from RegisterConsumer[A] toArrowAssoc[RegisterConsumer[A]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from DeliverySerializable

Inherited from Command[A]

Inherited from InternalCommand

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromRegisterConsumer[A] to any2stringadd[RegisterConsumer[A]]

Inherited by implicit conversion StringFormat fromRegisterConsumer[A] to StringFormat[RegisterConsumer[A]]

Inherited by implicit conversion Ensuring fromRegisterConsumer[A] to Ensuring[RegisterConsumer[A]]

Inherited by implicit conversion ArrowAssoc fromRegisterConsumer[A] to ArrowAssoc[RegisterConsumer[A]]

Ungrouped