Packages

  • package root
    Definition Classes
    root
  • package akka
    Definition Classes
    root
  • package cluster
    Definition Classes
    akka
  • package sharding
    Definition Classes
    cluster
  • package typed
    Definition Classes
    sharding
  • package delivery
    Definition Classes
    typed
  • object ShardingProducerController

    Reliable delivery between a producer actor sending messages to sharded consumer actors receiving the messages.

    Reliable delivery between a producer actor sending messages to sharded consumer actors receiving the messages.

    The ShardingProducerController should be used together with ShardingConsumerController.

    A producer can send messages via a ShardingProducerController to any ShardingConsumerController identified by an entityId. A single ShardingProducerController per ActorSystem (node) can be shared for sending to all entities of a certain entity type. No explicit registration is needed between the ShardingConsumerController and ShardingProducerController.

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

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

    In the RequestNext message there is information about which entities that have demand. It is allowed to send to a new entityId that is not included in the RequestNext.entitiesWithDemand. If sending to an entity that doesn't have demand the message will be buffered. This support for buffering means that it is even allowed to send several messages in response to one RequestNext but it's recommended to only send one message and wait for next RequestNext before sending more messages.

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

    There will be one ShardingConsumerController for each entity. Many unconfirmed messages can be in flight between the ShardingProducerController and each ShardingConsumerController. The flow control is driven by the consumer side, which means that the ShardingProducerController will not send faster than the demand requested by the consumers.

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

    Until sent messages have been confirmed the ShardingProducerController keeps them in memory to be able to resend them. If the JVM of the ShardingProducerController crashes those unconfirmed messages are lost. To make sure the messages can be delivered also in that scenario the ShardingProducerController 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.

    It's also possible to use the ShardingProducerController and ShardingConsumerController without resending lost messages, but the flow control is still used. 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 ShardingConsumerController.

    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 ShardingProducerController actor. ProducerController actors are created for each destination entity. Those child actors use the same dispatcher as the parent ShardingProducerController.

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

final class Settings extends AnyRef

Source
ShardingProducerController.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Settings
  2. AnyRef
  3. 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

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 Settings toany2stringadd[Settings] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Settings, B)
    Implicit
    This member is added by an implicit conversion from Settings toArrowAssoc[Settings] 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. val bufferSize: Int
  8. val cleanupUnusedAfter: FiniteDuration
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  10. def ensuring(cond: (Settings) => Boolean, msg: => Any): Settings
    Implicit
    This member is added by an implicit conversion from Settings toEnsuring[Settings] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: (Settings) => Boolean): Settings
    Implicit
    This member is added by an implicit conversion from Settings toEnsuring[Settings] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean, msg: => Any): Settings
    Implicit
    This member is added by an implicit conversion from Settings toEnsuring[Settings] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean): Settings
    Implicit
    This member is added by an implicit conversion from Settings toEnsuring[Settings] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  16. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. val internalAskTimeout: FiniteDuration
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  23. val producerControllerSettings: actor.typed.delivery.ProducerController.Settings
  24. val resendFirstUnconfirmedIdleTimeout: FiniteDuration
  25. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  26. def toString(): String
    Definition Classes
    Settings → AnyRef → Any
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. def withBufferSize(newBufferSize: Int): Settings
  31. def withCleanupUnusedAfter(newCleanupUnusedAfter: Duration): Settings
  32. def withCleanupUnusedAfter(newCleanupUnusedAfter: FiniteDuration): Settings
  33. def withInternalAskTimeout(newInternalAskTimeout: Duration): Settings
  34. def withInternalAskTimeout(newInternalAskTimeout: FiniteDuration): Settings
  35. def withProducerControllerSettings(newProducerControllerSettings: actor.typed.delivery.ProducerController.Settings): Settings
  36. def withResendFirsUnconfirmedIdleTimeout(newResendFirstUnconfirmedIdleTimeout: Duration): Settings
    Annotations
    @Deprecated
  37. def withResendFirstUnconfirmedIdleTimeout(newResendFirstUnconfirmedIdleTimeout: Duration): Settings
  38. def withResendFirstUnconfirmedIdleTimeout(newResendFirstUnconfirmedIdleTimeout: FiniteDuration): Settings

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
    Deprecated
  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from Settings toStringFormat[Settings] 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 resendFirsUnconfirmedIdleTimeout: FiniteDuration
    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.6.19) use resendFirstUnconfirmedIdleTimeout

  4. def withResendFirsUnconfirmedIdleTimeout(newResendFirstUnconfirmedIdleTimeout: FiniteDuration): Settings
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6.19) use resendFirstUnconfirmedIdleTimeout

  5. def [B](y: B): (Settings, B)
    Implicit
    This member is added by an implicit conversion from Settings toArrowAssoc[Settings] 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 AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromSettings to any2stringadd[Settings]

Inherited by implicit conversion StringFormat fromSettings to StringFormat[Settings]

Inherited by implicit conversion Ensuring fromSettings to Ensuring[Settings]

Inherited by implicit conversion ArrowAssoc fromSettings to ArrowAssoc[Settings]

Ungrouped