I have a system that uses Akka 2.2.4, which creates a bunch of local participants and sets them up as Broadcast Router routes. Each worker processes a certain segment of the overall work, in accordance with a certain range of hashes that we transmit. It works great.
Now I have to group this application to switch to another resource. Based on the requirement that only one working hash range exist or start on the cluster, it seems to me that setting each of them as ClusterSingletonManager will make sense ... I have problems with its operation. The actor system starts up, it creates the ClusterSingletonManager, it adds the path to the Broadcast Router code in the code below, but it never allows my actual working actor to process my messages for some reason. All I get is a log message: "unhandled event $ {my message} in Start state". What am I doing wrong? Is there anything else I need to do to start this single instance cluster? Can I send a message to the wrong actor?
here is my akka configuration (I use the default configuration as a backup):
akka{
cluster{
roles=["workerSystem"]
min-nr-of-members = 1
role {
workerSystem.min-nr-of-members = 1
}
}
daemonic = true
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = ${akkaPort}
}
}
actor{
provider = akka.cluster.ClusterActorRefProvider
single-message-bound-mailbox {
mailbox-type = "akka.dispatch.BoundedMailbox"
mailbox-capacity = 1
mailbox-push-timeout-time = 1
}
worker-dispatcher{
type = PinnedDispatcher
executor = "thread-pool-executor"
throughput = 500
thread-pool-executor {
keep-alive-time = 60s
core-pool-size-min = ${workerCount}
core-pool-size-factor = 3.0
core-pool-size-max = 64
max-pool-size-min = ${workerCount}
max-pool-size-factor = 3.0
max-pool-size-max = 64
task-queue-size = -1
task-queue-type = "linked"
allow-core-timeout = on
}
fork-join-executor {
parallelism-min = 1
parallelism-factor = 3.0
parallelism-max = 1
}
}
}
}
Here, where I create my Actors (its "written in Groovy):
Props clusteredProps = ClusterSingletonManager.defaultProps("worker".toString(), PoisonPill.getInstance(), "workerSystem",
new ClusterSingletonPropsFactory(){
@Override
Props create(Object handOverData) {
log.info("called in ClusterSingetonManager")
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()
path
when I try to send a message to the actual working actor, should the path above decide? This is currently not the case. What am I doing wrong? In addition, these actors live in the Spring application, and the working members are configured with some @Autowired dependencies. Although this Spring integration worked well in a non-clustered environment, are there any issues in the cluster environment I should be looking for?
Thank you
FYI: I also posted this in akka google user group. Here is the link.