Class ConsumerController
- java.lang.Object
-
- akka.actor.typed.delivery.ConsumerController
-
public class ConsumerController extends java.lang.ObjectConsumerControllerandProducerControllerorWorkPullingProducerControllerare 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.Startmessage to theConsumerController. TheActorRefin theStartmessage is typically constructed as a message adapter to map theConsumerController.Deliveryto the protocol of the consumer actor.Received messages from the producer are wrapped in
ConsumerController.Deliverywhen sent to the consumer, which is supposed to reply withConsumerController.Confirmedwhen 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 theConsumerControllerand delivered when previous message was confirmed.The consumer and the
ConsumerControlleractors are supposed to be local so that these messages are fast and not lost. This is enforced by a runtime check.The
ConsumerControlleris automatically stopped when the consumer that registered with theStartmessage is terminated.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceConsumerController.Command<A>static interfaceConsumerController.Confirmedstatic classConsumerController.Confirmed$When the message has been processed the consumer is supposed to sendConfirmedback to theConsumerControllervia theconfirmToin theConsumerController.Deliverymessage.static classConsumerController.DeliverThenStop<A>static classConsumerController.DeliverThenStop$static classConsumerController.Delivery<A>Received messages from the producer are wrapped inDeliverywhen sent to the consumer.static classConsumerController.Delivery$static classConsumerController.RegisterToProducerController<A>Register theConsumerControllerto the givenproducerController.static classConsumerController.RegisterToProducerController$static classConsumerController.SequencedMessage<A>static classConsumerController.SequencedMessage$static classConsumerController.Settingsstatic classConsumerController.Settings$static classConsumerController.Start<A>Initial message from the consumer actor.static classConsumerController.Start$
-
Constructor Summary
Constructors Constructor Description ConsumerController()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <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.Confirmedconfirmed()Java 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> java.lang.Class<ConsumerController.Delivery<A>>deliveryClass()Java API: The genericClasstype forConsumerController.Deliverythat can be used when creating amessageAdapterforClass.> static <A> java.lang.Class<ConsumerController.Command<A>>serviceKeyClass()Java API: The genericClasstype forConsumerController.Commandthat can be used when creating aServiceKeyforClass.>
-
-
-
Method Detail
-
deliveryClass
public static <A> java.lang.Class<ConsumerController.Delivery<A>> deliveryClass()
Java API: The genericClasstype forConsumerController.Deliverythat can be used when creating amessageAdapterforClass.>
-
serviceKeyClass
public static <A> java.lang.Class<ConsumerController.Command<A>> serviceKeyClass()
Java API: The genericClasstype forConsumerController.Commandthat can be used when creating aServiceKeyforClass.>
-
confirmed
public static ConsumerController.Confirmed 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
public static <A> Behavior<ConsumerController.Command<A>> 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 theReceptionistwith 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
public static <A> Behavior<ConsumerController.Command<A>> 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 theReceptionistwith 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
-
-