we are doing the same - though in Scala - you only have to wrap the message
with Persistent that the processor finally receives, as
shown in your first example.
One nice thing when sharding processors is that the decision which message
has to be wrapped with Persistent can be done in the processor's
shard idExtractor( and not the sender):
override val idExtractor: ShardRegion.IdExtractor = {
case cmd: Command => (cmd.id, Persistent(cmd))
}
hth,
michael
On Thursday, 12 June 2014 06:50:17 UTC+2, Luis Medina wrote:
>
> I'm having trouble sending messages to an ActorProcessor and I'm
> wondering if I'm sending it messages correctly. The actor's onReceive()
> method
> looks something like this:
>
> public class ActorProcessor extends UntypedProcessor {
> ...
> @Override
> public void onReceive(Object message) {
> if (message instanceof Persistent) {
> ...
> }
> }
> ...
> }
>
> so it only accepts Persistent messages. Now my question is, should I be
> sending it messages like this where I only wrap the payload in a Persistent
> object that the ActorProcessor receives?:
>
> shardRegion.tell(new ShardMessage(Persistent.create(props), id), self());
>
> *note - in this case my MessageExtractor will use the first parameter of
> ShardMessage
> as the entryMessage
>
> Or should the entire message that I send it be wrapped in a Persistent
> object?:
>
> shardRegion.tell(Persistent.create(new ShardMessage(props, id)), self());
>
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.