Package akka.cluster.sharding.typed
Class HashCodeNoEnvelopeMessageExtractor<M>
- java.lang.Object
-
- akka.cluster.sharding.typed.ShardingMessageExtractor<M,M>
-
- akka.cluster.sharding.typed.HashCodeNoEnvelopeMessageExtractor<M>
-
- Type Parameters:
M
- The type of message accepted by the entity actor
public abstract class HashCodeNoEnvelopeMessageExtractor<M> extends ShardingMessageExtractor<M,M>
Default message extractor type, using a property of the message to identify what entity a message is for and the hashcode of the entityId to decide which shard an entity belongs to.This is recommended since it does not force details about sharding into the entity protocol
-
-
Constructor Summary
Constructors Constructor Description HashCodeNoEnvelopeMessageExtractor(int numberOfShards)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
numberOfShards()
java.lang.String
shardId(java.lang.String entityId)
The shard identifier for a given entity id.java.lang.String
toString()
M
unwrapMessage(M message)
Extract the message to send to the entity from an incomingmessage
.-
Methods inherited from class akka.cluster.sharding.typed.ShardingMessageExtractor
apply, entityId, noEnvelope
-
-
-
-
Method Detail
-
numberOfShards
public int numberOfShards()
-
shardId
public java.lang.String shardId(java.lang.String entityId)
Description copied from class:ShardingMessageExtractor
The shard identifier for a given entity id. Only messages that passed theShardingMessageExtractor.entityId(E)
function will be used as input to this function.- Specified by:
shardId
in classShardingMessageExtractor<M,M>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
unwrapMessage
public final M unwrapMessage(M message)
Description copied from class:ShardingMessageExtractor
Extract the message to send to the entity from an incomingmessage
. Note that the extracted message does not have to be the same as the incoming message to support wrapping in message envelope that is unwrapped before sending to the entity actor.- Specified by:
unwrapMessage
in classShardingMessageExtractor<M,M>
-
-