Hello!

I have the following setup:

- actor TaskScheduler, registered through ClusterReceptionist like this:

  def main(args: Array[String]) {
    val port = if (args.isEmpty) "0" else args(0)
    val config = 
ConfigFactory.parseString(s"akka.remote.netty.tcp.port=$port").
      withFallback(ConfigFactory.parseString("akka.cluster.roles = 
[scheduler]")).
      withFallback(ConfigFactory.load("application"))
    val system = ActorSystem("HttpCluster", config)
    val svc = system.actorOf(FromConfig.props(Props[TaskSchedulerActor]), 
"router_scheduler")
    ClusterReceptionistExtension(system).registerService(svc)
  }

- actor TaskChunk, which is started from TaskScheduler.prestart like this:

   context.actorOf(FromConfig.props(Props[TaskChunkActor]), 
"router_chunkworker")

- the code, which starts the node for TaskChunkActor is pretty simple:

  def main(args: Array[String]) {
    val port = if (args.isEmpty) "0" else args(0)
    val config = 
ConfigFactory.parseString(s"akka.remote.netty.tcp.port=$port").
      withFallback(ConfigFactory.parseString("akka.cluster.roles = 
[chunk]")).
      withFallback(ConfigFactory.load("application"))
    ActorSystem("HttpCluster", config)
  }

- The configuration shared among all components:

akka {
    actor {
        provider = "akka.cluster.ClusterActorRefProvider"
        deployment {
          "/router_scheduler/*/router_chunkworker" {
            router = consistent-hashing-pool
            nr-of-instances = 3
            cluster {
              enabled = on
              max-nr-of-instances-per-node = 1
              allow-local-routees = off
              use-role = "chunk"
            }
          }
          "/router_scheduler" {
            router = consistent-hashing-pool
            nr-of-instances = 3
            cluster {
              enabled = on
              max-nr-of-instances-per-node = 1
              allow-local-routees = on
              use-role = "scheduler"
            }
          }
        }
    }
    remote {
        log-remote-lifecycle-events = on
        log-sent-messages = on
        log-received-messages = on
        netty.tcp {
            hostname = "127.0.0.1"
            port = 0
        }
    }

    cluster {
        seed-nodes = [
            "akka.tcp://HttpCluster@127.0.0.1:2551"]
            auto-down-unreachable-after = 10s
    }

    extensions = ["akka.contrib.pattern.ClusterReceptionistExtension"]

    loggers = ["akka.event.slf4j.Slf4jLogger"]
    loglevel = "DEBUG"

}

Now, the problem is when I start the test client:

object Cli {

  def main(args: Array[String]) {
    val system = ActorSystem("HttpCluster")
    val c = system.actorOf(ClusterClient.props(Set(
      
system.actorSelection("akka.tcp://HttpCluster@127.0.0.1:2551/user/receptionist")
    )))
    val ref = system.actorOf(Props(new Controller(c)), "controller")
    Thread.sleep(2000)
    ref ! TaskRequest(UUID.randomUUID(), args(0))
  }

   class Controller(client: ActorRef) extends Actor with ActorLogging {

    override def receive = {
      case (req: TaskRequest) ⇒
        log.info("Sending request: {}", req)
        client ! ClusterClient.Send("/user/router_scheduler", 
ConsistentHashableEnvelope(req, 17), true)
      case TaskResponse(uuid, data) ⇒
        log.info("Saving task request {} => {}", uuid, data)
        println(uuid)
        println(data)
        System.exit(0)
    }

  }

}

*Sometimes* I can see the following in the logs of TaskScheduler:

2014-05-20 22:57:36,082 WARN   [ConsistentHashingRoutingLogic] Message 
[service.Messages$TaskRequest] must be handled by hashMapping, or implement 
[akka.routing.ConsistentHashingRouter$ConsistentHashable] or be wrapped in 
[akka.routing.ConsistentHashingRouter$ConsistentHashableEnvelope] 

then some random number of subsequent messages are delivered to the actor 
just fine, and then another message causes error like above.

This happens only when I start an instance of TaskChunk node - if only 
TaskScheduler is started alone, then all TaskRequest messages are delivered 
correctly.

What is wrong with my setup? I assume that there is something wrong with 
the router configuration, e.g wrong router gets the message?

Please advice. Thanks!

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to