Class ConsumerController
ConsumerController and ProducerController or WorkPullingProducerController are used
together. See the descriptions in those classes or the Pekko 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic classWhen the message has been processed the consumer is supposed to sendConfirmedback to theConsumerControllervia theconfirmToin theConsumerController.Deliverymessage.static final classstatic classstatic final classReceived messages from the producer are wrapped inDeliverywhen sent to the consumer.static classstatic final classRegister theConsumerControllerto the givenproducerController.static classstatic final classstatic classstatic final classstatic classstatic final classInitial message from the consumer actor.static class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> Behavior<ConsumerController.Command<A>>apply()static <A> Behavior<ConsumerController.Command<A>>apply(ConsumerController.Settings settings) static <A> Behavior<ConsumerController.Command<A>>apply(ServiceKey<ConsumerController.Command<A>> serviceKey) To be used withWorkPullingProducerController.static <A> Behavior<ConsumerController.Command<A>>apply(ServiceKey<ConsumerController.Command<A>> serviceKey, ConsumerController.Settings settings) static ConsumerController.ConfirmedJava API: the singleton instance of the Confirmed message.static <A> Behavior<ConsumerController.Command<A>>create()Java APIstatic <A> Behavior<ConsumerController.Command<A>>create(ConsumerController.Settings settings) Java APIstatic <A> Behavior<ConsumerController.Command<A>>create(ServiceKey<ConsumerController.Command<A>> serviceKey) Java API: To be used withWorkPullingProducerController.static <A> Behavior<ConsumerController.Command<A>>create(ServiceKey<ConsumerController.Command<A>> serviceKey, ConsumerController.Settings settings) Java APIstatic <A> Class<ConsumerController.Delivery<A>>Java API: The genericClasstype forConsumerController.Deliverythat can be used when creating amessageAdapterforClass<Delivery.> static <A> Class<ConsumerController.Command<A>>Java API: The genericClasstype forConsumerController.Commandthat can be used when creating aServiceKeyforClass<Command.>
-
Constructor Details
-
ConsumerController
public ConsumerController()
-
-
Method Details
-
deliveryClass
Java API: The genericClasstype forConsumerController.Deliverythat can be used when creating amessageAdapterforClass<Delivery.> -
serviceKeyClass
Java API: The genericClasstype forConsumerController.Commandthat can be used when creating aServiceKeyforClass<Command.> -
confirmed
Java API: the singleton instance of the Confirmed message. When the message has been processed the consumer is supposed to sendConfirmedback to theConsumerControllervia theconfirmToin theConsumerController.Deliverymessage. -
apply
-
apply
public static <A> Behavior<ConsumerController.Command<A>> apply(ConsumerController.Settings settings) -
apply
public static <A> Behavior<ConsumerController.Command<A>> apply(ServiceKey<ConsumerController.Command<A>> serviceKey) To be used withWorkPullingProducerController. It will register itself to thepekko.actor.typed.receptionist.Receptionistwith the givenserviceKey, and theWorkPullingProducerControllersubscribes to the same key to find active workers. -
apply
public static <A> Behavior<ConsumerController.Command<A>> apply(ServiceKey<ConsumerController.Command<A>> serviceKey, ConsumerController.Settings settings) -
create
Java API -
create
public static <A> Behavior<ConsumerController.Command<A>> create(ConsumerController.Settings settings) Java API -
create
public static <A> Behavior<ConsumerController.Command<A>> create(ServiceKey<ConsumerController.Command<A>> serviceKey) Java API: To be used withWorkPullingProducerController. It will register itself to thepekko.actor.typed.receptionist.Receptionistwith the givenserviceKey, and theWorkPullingProducerControllersubscribes to the same key to find active workers. -
create
public static <A> Behavior<ConsumerController.Command<A>> create(ServiceKey<ConsumerController.Command<A>> serviceKey, ConsumerController.Settings settings) Java API
-