Namespace Akka.Cluster.Sharding.Delivery
Classes
ShardingConsumerController
ShardingConsumerController is used together with ShardingProducerController.
ShardingConsumerController is the entity actor that is initialized via ClusterSharding. It will manage the lifecycle and message delivery to the destination consumer actor (your actor type specified via Props in the Create<T>(Func<IActorRef, Props>, ShardingConsumerController.Settings) method.)
The destination consumer actor will start the flow by sending an initial ConsumerController.Start<T> message to the ShardingConsumerController, its parent actor.
Received messages from the producer are wrapped in a ConsumerController.Delivery<T> message and sent to the destination consumer actor, which is supposed to reply with ConsumerController.Confirmed when it has successfully processed the message.
Next message from the producer will not be delivered until the destination consumer actor has confirmed the previous message. However, since there can be several producers, e.g. one per node, sending messages to the same destination entity actor there can be multiple ConsumerController.Delivery<T> messages in flight at the same time.
More messages from a specific producer that arrive while waiting for the confirmation are stashed by the ConsumerController and delivered when the previous messages are confirmed.
ShardingConsumerController.Settings
ShardingProducerController
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 a unique String. 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 the ShardingProducerController.
The producer actor will start the flow by sending an initial ShardingProducerController.Start<T> messages to the ShardingProducerController.
ShardingProducerController.MessageWithConfirmation<T>
ShardingProducerController.RequestNext<T>
The ProducerController sends ShardingProducerController.RequestNext<T> to the producer when it is allowed to send one message via the SendNextTo or AskNextTo(ShardingProducerController.MessageWithConfirmation<T>). It should wait for next ShardingProducerController.RequestNext<T> before sending another message.
EntitiesWithDemand contains information about which entities that have demand. It is allowed to send to a new String that is not included in the EntitiesWithDemand. If sending to an entity that doesn't have demand the message will be buffered, and that can be seen in the BufferedForEntitiesWithoutDemand.
This support for buffering means that it is even allowed to send several messages in response to one ShardingProducerController.RequestNext<T>, but it's recommended to only send one message and wait for next ShardingProducerController.RequestNext<T> before sending more messages.
ShardingProducerController.Settings
ShardingProducerController.Start<T>
Interfaces
ShardingProducerController.IShardingProducerControllerCommand<T>
Marker interface for all commands handled by the ShardingProducerController.