I have an akka-http api that, upon receiving requests, sends messages to my 
Cluster via the cluster sharding region. The API layer doesn't know the 
ActorRefs of the actors in question, just the string identifiers.

region ! AddTarget(sourceId, targetId)

So Cluster Sharding works by looking up or creating the appropriate actor 
identified by "sourceId", passing "targetId" as an additional parameter.

Each actor can have many targets - they'll all be talking to each other.

>From within the source actor, I'm faced with the choice of storing those 
targets as List[String] or List[ActorRef].

If I stick with List[String], I can use context.parent to send the message 
to the targets, through the region.

If I use List[ActorRef] instead (presumably by doing a one time Identify 
exchange so I can get the ActorRef from the response's sender()), I'd be 
able to skip the region lookup on all ensuing communications.

Is one a best practice, or clearly better than the other? 

Thanks,
Curt

-- 
*****************************************************************************************************
** New discussion forum: https://discuss.akka.io/ replacing akka-user 
google-group soon.
** This group will soon be put into read-only mode, and replaced by 
discuss.akka.io
** More details: https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
>>>>>>>>>> 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to