akka.contrib.pattern
Class ClusterSharding

java.lang.Object
  extended by akka.contrib.pattern.ClusterSharding
All Implemented Interfaces:
Extension

public class ClusterSharding
extends java.lang.Object
implements Extension

See Also:
ClusterSharding companion object

Nested Class Summary
 class ClusterSharding.Settings$
          INTERNAL API
 
Constructor Summary
ClusterSharding(ExtendedActorSystem system)
           
 
Method Summary
static ClusterSharding createExtension(ExtendedActorSystem system)
           
static ClusterSharding get(ActorSystem system)
           
static ClusterSharding$ lookup()
           
 ClusterSharding.Settings$ Settings()
          Accessor for nested Scala object
 ActorRef shardRegion(java.lang.String typeName)
          Retrieve the actor reference of the ShardRegion actor responsible for the named entry type.
 ActorRef start(java.lang.String typeName, scala.Option<Props> entryProps, scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> idExtractor, scala.Function1<java.lang.Object,java.lang.String> shardResolver)
          Register a named entry type by defining the Props of the entry actor and functions to extract entry and shard identifier from messages.
 ActorRef start(java.lang.String typeName, scala.Option<Props> entryProps, scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> idExtractor, scala.Function1<java.lang.Object,java.lang.String> shardResolver, ShardCoordinator.ShardAllocationStrategy allocationStrategy)
          Scala API: Register a named entry type by defining the Props of the entry actor and functions to extract entry and shard identifier from messages.
 ActorRef start(java.lang.String typeName, Props entryProps, ShardRegion.MessageExtractor messageExtractor)
          Java API: Register a named entry type by defining the Props of the entry actor and functions to extract entry and shard identifier from messages.
 ActorRef start(java.lang.String typeName, Props entryProps, ShardRegion.MessageExtractor messageExtractor, ShardCoordinator.ShardAllocationStrategy allocationStrategy)
          Java API: Register a named entry type by defining the Props of the entry actor and functions to extract entry and shard identifier from messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterSharding

public ClusterSharding(ExtendedActorSystem system)
Method Detail

get

public static ClusterSharding get(ActorSystem system)

lookup

public static ClusterSharding$ lookup()

createExtension

public static ClusterSharding createExtension(ExtendedActorSystem system)

Settings

public ClusterSharding.Settings$ Settings()
Accessor for nested Scala object

Returns:
(undocumented)

start

public ActorRef start(java.lang.String typeName,
                      scala.Option<Props> entryProps,
                      scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> idExtractor,
                      scala.Function1<java.lang.Object,java.lang.String> shardResolver,
                      ShardCoordinator.ShardAllocationStrategy allocationStrategy)
Scala API: Register a named entry type by defining the Props of the entry actor and functions to extract entry and shard identifier from messages. The ShardRegion actor for this type can later be retrieved with the shardRegion(java.lang.String) method.

Some settings can be configured as described in the akka.contrib.cluster.sharding section of the reference.conf.

Parameters:
typeName - the name of the entry type
entryProps - the Props of the entry actors that will be created by the ShardRegion, if not defined (None) the ShardRegion on this node will run in proxy only mode, i.e. it will delegate messages to other ShardRegion actors on other nodes, but not host any entry actors itself
idExtractor - partial function to extract the entry id and the message to send to the entry from the incoming message, if the partial function does not match the message will be unhandled, i.e. posted as Unhandled messages on the event stream
shardResolver - function to determine the shard id for an incoming message, only messages that passed the idExtractor will be used
allocationStrategy - possibility to use a custom shard allocation and rebalancing logic
Returns:
the actor ref of the ShardRegion that is to be responsible for the shard

start

public ActorRef start(java.lang.String typeName,
                      scala.Option<Props> entryProps,
                      scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> idExtractor,
                      scala.Function1<java.lang.Object,java.lang.String> shardResolver)
Register a named entry type by defining the Props of the entry actor and functions to extract entry and shard identifier from messages. The ShardRegion actor for this type can later be retrieved with the shardRegion(java.lang.String) method.

The default shard allocation strategy ShardCoordinator.LeastShardAllocationStrategy is used.

Some settings can be configured as described in the akka.contrib.cluster.sharding section of the reference.conf.

Parameters:
typeName - the name of the entry type
entryProps - the Props of the entry actors that will be created by the ShardRegion, if not defined (None) the ShardRegion on this node will run in proxy only mode, i.e. it will delegate messages to other ShardRegion actors on other nodes, but not host any entry actors itself
idExtractor - partial function to extract the entry id and the message to send to the entry from the incoming message, if the partial function does not match the message will be unhandled, i.e. posted as Unhandled messages on the event stream
shardResolver - function to determine the shard id for an incoming message, only messages that passed the idExtractor will be used
Returns:
the actor ref of the ShardRegion that is to be responsible for the shard

start

public ActorRef start(java.lang.String typeName,
                      Props entryProps,
                      ShardRegion.MessageExtractor messageExtractor,
                      ShardCoordinator.ShardAllocationStrategy allocationStrategy)
Java API: Register a named entry type by defining the Props of the entry actor and functions to extract entry and shard identifier from messages. The ShardRegion actor for this type can later be retrieved with the shardRegion(java.lang.String) method.

Some settings can be configured as described in the akka.contrib.cluster.sharding section of the reference.conf.

Parameters:
typeName - the name of the entry type
entryProps - the Props of the entry actors that will be created by the ShardRegion, if not defined (null) the ShardRegion on this node will run in proxy only mode, i.e. it will delegate messages to other ShardRegion actors on other nodes, but not host any entry actors itself
messageExtractor - functions to extract the entry id, shard id, and the message to send to the entry from the incoming message
allocationStrategy - possibility to use a custom shard allocation and rebalancing logic
Returns:
the actor ref of the ShardRegion that is to be responsible for the shard

start

public ActorRef start(java.lang.String typeName,
                      Props entryProps,
                      ShardRegion.MessageExtractor messageExtractor)
Java API: Register a named entry type by defining the Props of the entry actor and functions to extract entry and shard identifier from messages. The ShardRegion actor for this type can later be retrieved with the shardRegion(java.lang.String) method.

The default shard allocation strategy ShardCoordinator.LeastShardAllocationStrategy is used.

Some settings can be configured as described in the akka.contrib.cluster.sharding section of the reference.conf.

Parameters:
typeName - the name of the entry type
entryProps - the Props of the entry actors that will be created by the ShardRegion, if not defined (null) the ShardRegion on this node will run in proxy only mode, i.e. it will delegate messages to other ShardRegion actors on other nodes, but not host any entry actors itself
messageExtractor - functions to extract the entry id, shard id, and the message to send to the entry from the incoming message
Returns:
the actor ref of the ShardRegion that is to be responsible for the shard

shardRegion

public ActorRef shardRegion(java.lang.String typeName)
Retrieve the actor reference of the ShardRegion actor responsible for the named entry type. The entry type must be registered with the start(java.lang.String, scala.Option, scala.PartialFunction>, scala.Function1, akka.contrib.pattern.ShardCoordinator.ShardAllocationStrategy) method before it can be used here. Messages to the entry is always sent via the ShardRegion.

Parameters:
typeName - (undocumented)
Returns:
(undocumented)