Class ShardingConsumerController
- java.lang.Object
-
- org.apache.pekko.cluster.sharding.typed.delivery.ShardingConsumerController
-
public class ShardingConsumerController extends java.lang.ObjectShardingConsumerControlleris used together withShardingProducerController. See the description in that class or the Pekko reference documentation for how they are intended to be used.ShardingConsumerControlleris the entity that is initialized inClusterSharding. It will manage the lifecycle and message delivery to the destination consumer actor.The destination consumer actor will start the flow by sending an initial
pekko.actor.typed.delivery.ConsumerController.Startmessage via theActorRefprovided in the factory function of the consumerBehavior. TheActorRefin theStartmessage is typically constructed as a message adapter to map thepekko.actor.typed.delivery.ConsumerController.Deliveryto the protocol of the consumer actor.Received messages from the producer are wrapped in
pekko.actor.typed.delivery.ConsumerController.Deliverywhen sent to the consumer, which is supposed to reply withpekko.actor.typed.delivery.ConsumerController.Confirmedwhen it has processed the message. Next message from a specific producer is not delivered until the previous is confirmed. However, since there can be several producers, e.g. one per node, sending to the same destination entity there can be severalDeliveryin flight at the same time. More messages from a specific producer that arrive while waiting for the confirmation are stashed by theConsumerControllerand delivered when previous message was confirmed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classShardingConsumerController.Settingsstatic classShardingConsumerController.Settings$
-
Constructor Summary
Constructors Constructor Description ShardingConsumerController()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A,B>
Behavior<ConsumerController.SequencedMessage<A>>apply(scala.Function1<ActorRef<ConsumerController.Start<A>>,Behavior<B>> consumerBehavior)TheBehaviorof the entity that is to be initialized inClusterSharding.static <A,B>
Behavior<ConsumerController.SequencedMessage<A>>create(java.util.function.Function<ActorRef<ConsumerController.Start<A>>,Behavior<B>> consumerBehavior)Java API: TheBehaviorof the entity that is to be initialized inClusterSharding.static <A,B>
Behavior<ConsumerController.SequencedMessage<A>>create(java.util.function.Function<ActorRef<ConsumerController.Start<A>>,Behavior<B>> consumerBehavior, ShardingConsumerController.Settings settings)Java API: TheBehaviorof the entity that is to be initialized inClusterSharding.static <A> java.lang.Class<ConsumerController.SequencedMessage<A>>entityTypeKeyClass()Java API: The genericClasstype forConsumerController.SequencedMessagethat can be used when creating anEntityTypeKeyfor theShardedConsumerControllerwithClass.>> static <A,B>
Behavior<ConsumerController.SequencedMessage<A>>withSettings(ShardingConsumerController.Settings settings, scala.Function1<ActorRef<ConsumerController.Start<A>>,Behavior<B>> consumerBehavior)TheBehaviorof the entity that is to be initialized inClusterSharding.
-
-
-
Method Detail
-
apply
public static <A,B> Behavior<ConsumerController.SequencedMessage<A>> apply(scala.Function1<ActorRef<ConsumerController.Start<A>>,Behavior<B>> consumerBehavior)
TheBehaviorof the entity that is to be initialized inClusterSharding. It will manage the lifecycle and message delivery to the destination consumer actor.
-
withSettings
public static <A,B> Behavior<ConsumerController.SequencedMessage<A>> withSettings(ShardingConsumerController.Settings settings, scala.Function1<ActorRef<ConsumerController.Start<A>>,Behavior<B>> consumerBehavior)
TheBehaviorof the entity that is to be initialized inClusterSharding. It will manage the lifecycle and message delivery to the destination consumer actor.
-
create
public static <A,B> Behavior<ConsumerController.SequencedMessage<A>> create(java.util.function.Function<ActorRef<ConsumerController.Start<A>>,Behavior<B>> consumerBehavior)
Java API: TheBehaviorof the entity that is to be initialized inClusterSharding. It will manage the lifecycle and message delivery to the destination consumer actor.
-
create
public static <A,B> Behavior<ConsumerController.SequencedMessage<A>> create(java.util.function.Function<ActorRef<ConsumerController.Start<A>>,Behavior<B>> consumerBehavior, ShardingConsumerController.Settings settings)
Java API: TheBehaviorof the entity that is to be initialized inClusterSharding. It will manage the lifecycle and message delivery to the destination consumer actor.
-
entityTypeKeyClass
public static <A> java.lang.Class<ConsumerController.SequencedMessage<A>> entityTypeKeyClass()
Java API: The genericClasstype forConsumerController.SequencedMessagethat can be used when creating anEntityTypeKeyfor theShardedConsumerControllerwithClass.>>
-
-