Hi,

I followed the Advanced akka course in the last 2 days (which was awesome 
by the way) and noticed something of the API which I think can be improved. 
When you start the ClusterSharding its return type is Unit and you have to 
retrieve the ShardRegion by calling the "shardRegion" on ClusterSharding. 
However, this cannot take place in a short period, because 
"shardRegion(...)" will 'throw new IllegalArgumentException(s"Shard type 
[$typeName] must be started first")'.

In my mind it would be an improvement if the start returns an ActorRef 
immediately and then buffers all requests to it until the ShardRegion is 
initialized. Am I overlooking some problems with that?

Cheers,
Jeroen

-- Start ShardRegion
ClusterSharding(context.system).start(
    "player",
    Some(Player.props),
    Player.idExtractor,
    Player.shardResolver(10)
  )

-- get reference to ShardRegion
  val playerRegion = ClusterSharding(context.system).shardRegion("player")

-- 
>>>>>>>>>>      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.

Reply via email to