Class HashCodeMessageExtractor
Convenience implementation of IMessageExtractor that construct ShardId based on the StringHash(string) of the EntityId. The number of unique shards is limited by the given MaxNumberOfShards.
Implements
Inherited Members
Namespace: Akka.Cluster.Sharding
Assembly: Akka.Cluster.Sharding.dll
Syntax
public abstract class HashCodeMessageExtractor : IMessageExtractor
Constructors
| Edit this page View SourceHashCodeMessageExtractor(int)
TBD
Declaration
protected HashCodeMessageExtractor(int maxNumberOfShards)
Parameters
Type | Name | Description |
---|---|---|
int | maxNumberOfShards | TBD |
Fields
| Edit this page View SourceMaxNumberOfShards
TBD
Declaration
public readonly int MaxNumberOfShards
Field Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceCreate(int, Func<object, string?>, Func<object, object>?)
creates a instance of the HashCodeMessageExtractor with the given handlers
Declaration
public static HashCodeMessageExtractor Create(int maxNumberOfShards, Func<object, string?> entityIdExtractor, Func<object, object>? messageExtractor = null)
Parameters
Type | Name | Description |
---|---|---|
int | maxNumberOfShards | |
Func<object, string> | entityIdExtractor | |
Func<object, object> | messageExtractor |
Returns
Type | Description |
---|---|
HashCodeMessageExtractor |
EntityId(object)
TBD
Declaration
public abstract string? EntityId(object message)
Parameters
Type | Name | Description |
---|---|---|
object | message | TBD |
Returns
Type | Description |
---|---|
string | TBD |
EntityMessage(object)
Default implementation pass on the message as is.
Declaration
public virtual object? EntityMessage(object message)
Parameters
Type | Name | Description |
---|---|---|
object | message | TBD |
Returns
Type | Description |
---|---|
object | TBD |
ShardId(object)
TBD
Declaration
[Obsolete("Use ShardId(string, object?) instead. Since v1.5.15")]
public virtual string? ShardId(object message)
Parameters
Type | Name | Description |
---|---|---|
object | message | TBD |
Returns
Type | Description |
---|---|
string | TBD |
ShardId(string, object?)
More performant overload of EntityId(object) that accepts an entity id in order to allow faster method chaining and comparisons inside Akka.NET.
Declaration
public virtual string ShardId(string entityId, object? messageHint = null)
Parameters
Type | Name | Description |
---|---|---|
string | entityId | Should always be populated with a non-null value. |
object | messageHint | The message - FOR BACKWARDS COMPATIBILITY ONLY. |
Returns
Type | Description |
---|---|
string | The ShardId. |