Class ShardedDaemonProcess
This extension runs a pre-set number of actors in a cluster.
The typical use case is when you have a task that can be divided in a number of workers, each doing a sharded part of the work, for example consuming the read side events from Akka Persistence through tagged events where each tag decides which consumer that should consume the event.
Each named set needs to be started on all the nodes of the cluster on start up.
The processes are spread out across the cluster, when the cluster topology changes the processes may be stopped and started anew on a new node to rebalance them.
Not for user extension.
Implements
Inherited Members
Namespace: Akka.Cluster.Sharding
Assembly: Akka.Cluster.Sharding.dll
Syntax
public class ShardedDaemonProcess : IExtension
Constructors
| Improve this Doc View SourceShardedDaemonProcess(ExtendedActorSystem)
Declaration
public ShardedDaemonProcess(ExtendedActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ExtendedActorSystem | system |
Methods
| Improve this Doc View SourceGet(ActorSystem)
Declaration
public static ShardedDaemonProcess Get(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ActorSystem | system |
Returns
Type | Description |
---|---|
ShardedDaemonProcess |
Init(String, Int32, Func<Int32, Props>)
Start a specific number of actors that is then kept alive in the cluster.
Declaration
public IActorRef Init(string name, int numberOfInstances, Func<int, Props> propsFactory)
Parameters
Type | Name | Description |
---|---|---|
String | name | TBD |
Int32 | numberOfInstances | TBD |
Func<Int32, Props> | propsFactory | Given a unique id of |
Returns
Type | Description |
---|---|
IActorRef | A reference to a router actor that will distribute all messages evenly across the workers
using round-robin message routing. |
Init(String, Int32, Func<Int32, Props>, ShardedDaemonProcessSettings, Object)
Start a specific number of actors, each with a unique numeric id in the set, that is then kept alive in the cluster.
Declaration
public IActorRef Init(string name, int numberOfInstances, Func<int, Props> propsFactory, ShardedDaemonProcessSettings settings, object stopMessage)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of this sharded daemon set |
Int32 | numberOfInstances | The number of instances to run |
Func<Int32, Props> | propsFactory | Given a unique id of |
ShardedDaemonProcessSettings | settings | The settings for configuring this sharded daemon process. |
Object | stopMessage | If defined sent to the actors when they need to stop because of a rebalance across the nodes of the cluster or cluster shutdown. |
Returns
Type | Description |
---|---|
IActorRef | A reference to a router actor that will distribute all messages evenly across the workers
using round-robin message routing. |
Init(String, Int32, Func<Int32, Props>, Object)
Start a specific number of actors that is then kept alive in the cluster.
Declaration
public IActorRef Init(string name, int numberOfInstances, Func<int, Props> propsFactory, object stopMessage)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of this sharded daemon set |
Int32 | numberOfInstances | The number of instances to run |
Func<Int32, Props> | propsFactory | Given a unique id of |
Object | stopMessage | Sent to the actors when they need to stop because of a rebalance across the nodes of the cluster or cluster shutdown. |
Returns
Type | Description |
---|---|
IActorRef | A reference to a router actor that will distribute all messages evenly across the workers
using round-robin message routing. |
InitProxy(String, Int32, String)
Starts a proxy for a sharded daemon process running in a different role.
Declaration
public IActorRef InitProxy(string name, int numberOfInstances, string role)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of this daemon worker set |
Int32 | numberOfInstances | The number of instances that belong on this set -
note that this value must match the value used in the |
String | role | The role where the worker actors are hosted. |
Returns
Type | Description |
---|---|
IActorRef | A reference to a router actor that will distribute all messages evenly across the workers using round-robin message routing. |