object ConsumerController
ConsumerController
and ProducerController or WorkPullingProducerController are used
together. See the descriptions in those classes or the Akka reference documentation for
how they are intended to be used.
The destination consumer actor will start the flow by sending an initial ConsumerController.Start
message to the ConsumerController
. The ActorRef
in the Start
message is typically constructed
as a message adapter to map the ConsumerController.Delivery to the protocol of the consumer actor.
Received messages from the producer are wrapped in ConsumerController.Delivery when sent to the consumer,
which is supposed to reply with ConsumerController.Confirmed when it has processed the message.
Next message is not delivered until the previous is confirmed.
More messages from the producer that arrive while waiting for the confirmation are stashed by
the ConsumerController
and delivered when previous message was confirmed.
The consumer and the ConsumerController
actors are supposed to be local so that these messages are fast
and not lost. This is enforced by a runtime check.
The ConsumerController
is automatically stopped when the consumer that registered with the Start
message is terminated.
- Annotations
- @ApiMayChange()
- Source
- ConsumerController.scala
- Alphabetic
- By Inheritance
- ConsumerController
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- sealed trait Command[+A] extends UnsealedInternalCommand
- trait Confirmed extends UnsealedInternalCommand
- Annotations
- @DoNotInherit()
- final case class DeliverThenStop[A]() extends Command[A] with Product with Serializable
- final class Delivery[A] extends AnyRef
Received messages from the producer are wrapped in
Delivery
when sent to the consumer.Received messages from the producer are wrapped in
Delivery
when sent to the consumer. When the message has been processed the consumer is supposed to send Confirmed back to theConsumerController
via theconfirmTo
. - final case class RegisterToProducerController[A](producerController: ActorRef[ProducerController.Command[A]]) extends Command[A] with Product with Serializable
Register the
ConsumerController
to the givenproducerController
.Register the
ConsumerController
to the givenproducerController
. It will retry the registration until theProducerController
has acknowledged by sending its first message.Alternatively, this registration can be done on the producer side with the ProducerController.RegisterConsumer message.
- type SeqNr = Long
- final case class SequencedMessage[A](producerId: String, seqNr: SeqNr, message: MessageOrChunk, first: Boolean, ack: Boolean)(producerController: ActorRef[InternalCommand]) extends Command[A] with DeliverySerializable with DeadLetterSuppression with Product with Serializable
This is used between the
ProducerController
andConsumerController
.This is used between the
ProducerController
andConsumerController
. Should rarely be used in application code but is public because it's in the signature for theEntityTypeKey
when usingShardingConsumerController
.In the future we may also make the custom
send
inProducerController
public to make it possible to wrap it or send it in other ways when building higher level abstractions that are using theProducerController
. That is used byShardingProducerController
.- producerController
INTERNAL API: construction of SequencedMessage is internal
- final class Settings extends AnyRef
- final case class Start[A](deliverTo: ActorRef[Delivery[A]]) extends Command[A] with Product with Serializable
Initial message from the consumer actor.
Initial message from the consumer actor. The
deliverTo
is typically constructed as a message adapter to map the Delivery to the protocol of the consumer actor.If the consumer is restarted it should send a new
Start
message to theConsumerController
.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply[A](serviceKey: ServiceKey[Command[A]], settings: Settings): Behavior[Command[A]]
- def apply[A](serviceKey: ServiceKey[Command[A]]): Behavior[Command[A]]
To be used with WorkPullingProducerController.
To be used with WorkPullingProducerController. It will register itself to the akka.actor.typed.receptionist.Receptionist with the given
serviceKey
, and theWorkPullingProducerController
subscribes to the same key to find active workers. - def apply[A](settings: Settings): Behavior[Command[A]]
- def apply[A](): Behavior[Command[A]]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def confirmed(): Confirmed
Java API: the singleton instance of the Confirmed message.
Java API: the singleton instance of the Confirmed message. When the message has been processed the consumer is supposed to send
Confirmed
back to theConsumerController
via theconfirmTo
in the Delivery message. - def create[A](serviceKey: ServiceKey[Command[A]], settings: Settings): Behavior[Command[A]]
Java API
- def create[A](serviceKey: ServiceKey[Command[A]]): Behavior[Command[A]]
Java API: To be used with WorkPullingProducerController.
Java API: To be used with WorkPullingProducerController. It will register itself to the akka.actor.typed.receptionist.Receptionist with the given
serviceKey
, and theWorkPullingProducerController
subscribes to the same key to find active workers. - def create[A](settings: Settings): Behavior[Command[A]]
Java API
- def create[A](): Behavior[Command[A]]
Java API
- def deliveryClass[A](): Class[Delivery[A]]
Java API: The generic
Class
type forConsumerController.Delivery
that can be used when creating amessageAdapter
forClass<Delivery<MessageType>>
. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def serviceKeyClass[A]: Class[Command[A]]
Java API: The generic
Class
type forConsumerController.Command
that can be used when creating aServiceKey
forClass<Command<MessageType>>
. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- case object Confirmed extends Confirmed with Product with Serializable
When the message has been processed the consumer is supposed to send
Confirmed
back to theConsumerController
via theconfirmTo
in the Delivery message. - object Delivery
- object SequencedMessage extends Serializable
- object Settings