Class 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.
Implements
Inherited Members
Namespace: Akka.Cluster.Sharding.Delivery
Assembly: Akka.Cluster.Sharding.dll
Syntax
public sealed class RequestNext<T> : IEquatable<ShardingProducerController.RequestNext<T>>
Type Parameters
Name | Description |
---|---|
T | The type of message that can be handled by the consumer actors. |
Constructors
| Improve this Doc View SourceRequestNext(IActorRef, IActorRef, ImmutableHashSet<String>, ImmutableDictionary<String, Int32>)
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.
Declaration
public RequestNext(IActorRef SendNextTo, IActorRef AskNextToRef, ImmutableHashSet<string> EntitiesWithDemand, ImmutableDictionary<string, int> BufferedForEntitiesWithoutDemand)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | SendNextTo | |
IActorRef | AskNextToRef | |
System.Collections.Immutable.ImmutableHashSet<String> | EntitiesWithDemand | |
System.Collections.Immutable.ImmutableDictionary<String, Int32> | BufferedForEntitiesWithoutDemand |
Properties
| Improve this Doc View SourceAskNextToRef
Declaration
public IActorRef AskNextToRef { get; set; }
Property Value
Type | Description |
---|---|
IActorRef |
BufferedForEntitiesWithoutDemand
Declaration
public ImmutableDictionary<string, int> BufferedForEntitiesWithoutDemand { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.ImmutableDictionary<String, Int32> |
EntitiesWithDemand
Declaration
public ImmutableHashSet<string> EntitiesWithDemand { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.ImmutableHashSet<String> |
SendNextTo
Declaration
public IActorRef SendNextTo { get; set; }
Property Value
Type | Description |
---|---|
IActorRef |
Methods
| Improve this Doc View SourceAskNextTo(ShardingProducerController.MessageWithConfirmation<T>)
Delivers a ShardingProducerController.MessageWithConfirmation<T> to the SendNextTo actor.
The ReplyTo actor will receive a confirmation message containing the confirmed SeqNo (long) for this message once it's been successfully processed by the consumer.
Declaration
public void AskNextTo(ShardingProducerController.MessageWithConfirmation<T> msgWithConfirmation)
Parameters
Type | Name | Description |
---|---|---|
ShardingProducerController.MessageWithConfirmation<T> | msgWithConfirmation | The message and the replyTo address. |
Remarks
This method name is a bit misleading - we're actually performing a Tell, not an Ask.
The other overload does perform an Ask and uses the temporary Ask actor as the replyTo address.
AskNextTo(String, T, CancellationToken)
Uses an Ask{T} to send the message to the SendNextTo actor and returns an Ack(long).
Declaration
public Task<long> AskNextTo(string entityId, T msg, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | entityId | The id of the entity we're messaging. |
T | msg | The message to send with confirmation back to the temporary Ask actor. |
CancellationToken | cancellationToken | Optional - a CancellationToken. Note: this token only cancels the receipt of the Ack (long) - it does not stop the message from being delivered. |
Returns
Type | Description |
---|---|
Task<Int64> | A task that will complete once the message has been successfully persisted by the ProducerController. |