Package akka.cluster.sharding.typed
Class ShardingMessageExtractor<E,M>
- java.lang.Object
-
- akka.cluster.sharding.typed.ShardingMessageExtractor<E,M>
-
- Direct Known Subclasses:
ExtractorAdapter
,HashCodeMessageExtractor
,HashCodeNoEnvelopeMessageExtractor
public abstract class ShardingMessageExtractor<E,M> extends java.lang.Object
Extract the entity id from an incomingmessage
. Ifnull
is returned the message will beunhandled
, i.e. posted asUnhandled
messages on the event stream
-
-
Constructor Summary
Constructors Constructor Description ShardingMessageExtractor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <M> ShardingMessageExtractor<ShardingEnvelope<M>,M>
apply(int numberOfShards)
abstract java.lang.String
entityId(E message)
static <M> ShardingMessageExtractor<M,M>
noEnvelope(int numberOfShards, M stopMessage, scala.Function1<M,java.lang.String> extractEntityId)
Scala API: Create a message extractor for a protocol where the entity id is available in each message.abstract java.lang.String
shardId(java.lang.String entityId)
The shard identifier for a given entity id.abstract M
unwrapMessage(E message)
Extract the message to send to the entity from an incomingmessage
.
-
-
-
Method Detail
-
apply
public static <M> ShardingMessageExtractor<ShardingEnvelope<M>,M> apply(int numberOfShards)
-
noEnvelope
public static <M> ShardingMessageExtractor<M,M> noEnvelope(int numberOfShards, M stopMessage, scala.Function1<M,java.lang.String> extractEntityId)
Scala API: Create a message extractor for a protocol where the entity id is available in each message.- Parameters:
numberOfShards
- (undocumented)stopMessage
- (undocumented)extractEntityId
- (undocumented)- Returns:
- (undocumented)
-
entityId
public abstract java.lang.String entityId(E message)
-
shardId
public abstract java.lang.String shardId(java.lang.String entityId)
The shard identifier for a given entity id. Only messages that passed theentityId(E)
function will be used as input to this function.- Parameters:
entityId
- (undocumented)- Returns:
- (undocumented)
-
unwrapMessage
public abstract M unwrapMessage(E message)
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.- Parameters:
message
- (undocumented)- Returns:
- (undocumented)
-
-