Hi All-

This issue is a repost from a stack overflow 
question<http://stackoverflow.com/questions/22547889/akka-actors-and-clustering-im-having-trouble-with-clustersingletonmanager-unha>I
 currently have, but Patrik 
Nordwall <http://stackoverflow.com/users/1835220/patrik-nordwall> suggested 
I post it here as well.

Currently the system in prod uses only local actors.  The basic 
functionality of the app is that we have a bunch of actors that are each 
responsible some work based on a range of hashed identifiers(hashed so 
there is a fairly even distribution of work).  A constraint with our 
algorithm is that only one actor can work on that hash range at a time-so 
some state in the actor is the starthash and the endhash.  The application 
is time based and every couple of minutes, we send a "WORK" message to each 
actor and based on the range they are responsible for they pull some data 
out of a sql database and process it.  While this may not be an optimal 
architecture, this project is the first akka based project at this company 
and we want to keep it simple.

A new requirement is that we have to handle failover.  I've been 
prototyping using the ClusteredSingletonManager.  It looks like the 
simplest way to accomplish what I want-which is one actor across the 
cluster that will be created/called per hash range.

Here's the snippet of code that duplicates what I'm doing:

ActorSystem system = ActorSystem.create("${applicationName}-actor-system", 
clusterConfig)

Props clusteredProps = 
ClusterSingletonManager.defaultProps("worker".toString(), 
PoisonPill.getInstance(), "workerSystem",
                            new ClusterSingletonPropsFactory(){

                                @Override
                                Props create(Object handOverData) {
                                    log.info("called in 
ClusterSingetonManager")
                                    //WorkerActorCreator.create makes a 
new Creator that'll wire up our newly created Actor with the spring 
services it craves.
                                    
Props.create(WorkerActorCreator.create(applicationContext, it.start, 
it.end)).withDispatcher("akka.actor.worker-dispatcher").withMailbox("akka.actor.single-message-bound-mailbox")
                                }
                            } )
ActorRef manager = system.actorOf(clusteredProps, 
"worker-${it.start}-${it.end}".toString())

String path = manager.path().child("worker").toString()


//This should call my shiny new singleton worker?
system.actorSelection(path).tell(WORK)



Is there something I'm doing wrong?  Anything would be appreciated.

Mike


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