It is hard to explain, but in short my master actor receives a message 
which is then forwarded to the respective worker, and from that message I 
extract business information to make my worker's (FSM) persistenceId 
unique. 

After I second thought, maybe I misunderstood the router concept - I just 
realized that this code load balances the work between the actors, but you 
are right, I need to find a way how to distribute it equally among the 
nodes which I suppose is done by the cluster sharding.

On Wednesday, March 15, 2017 at 7:19:07 AM UTC+1, Patrik Nordwall wrote:
>
> What persistenceIds would you like to use in the end?
>
> Based on a counter? PO-1, PO-2, ... increasing for each routee?
> Would be strange in a long running system when worker nodes are added and 
> removed over time.
>
> Why not use Cluster Sharding instead? Wouldn't it be more natural to have 
> a separate entity actor for each purchase order instead of using 
> round-robin.
>
> /Patrik
> tis 14 mars 2017 kl. 09:26 skrev <mladen....@gmail.com <javascript:>>:
>
>> To explain my issue in a clear way I provided a sample code:
>>
>> if I have an actor which looks like this:
>>
>> class MasterActor extends Actor with ActorLogging with WorkerRouter with 
>> AkkaProvider { 
>>     
>>   private val router = createWorkerRouter()
>>
>>
>>   def receive = {
>>      case PurchaseOrderMsg(content,timestamp) =>
>>        router ! Response(timestamp)
>>
>>
>> trait WorkerRouter {this: Actor =>
>>  def createWorkerRouter(): ActorRef = {
>>     val resizer = DefaultResizer(lowerBound = 2, upperBound = 15)
>>     context.actorOf(
>>         ClusterRouterPool(RoundRobinPool(7,Some(resizer)),
>>                            ClusterRouterPoolSettings(
>>                                   totalInstances = Int.MaxValue,
>>                                   maxInstancesPerNode = 10,
>>                                   allowLocalRoutees = false,
>>                                   useRole = Some("worker"))
>>                            ).props(Worker.props(???),
>>                            name = "purchase-order-router")
>>      }
>> }
>>
>>
>>
>>
>>
>> How do I pass dynamically props to createWorkerRouter from my MasterActor?
>>
>> I use the props from the Worker as persistence_id since it's a FSM therefore 
>> it has to be unique.
>>
>> -- 
>> >>>>>>>>>> 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+...@googlegroups.com <javascript:>.
>> To post to this group, send email to akka...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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