Akka远程演员与自定义调度员

时间:2014-11-07 12:44:24

标签: scala playframework akka remote-actors

使用“UnboundedDequeBasedMailbox”创建远程actor时遇到了困难 我有来自演员的主人机器,以及演员将在哪里运行。

master.conf:

#Akka remote configuration
akka {
  actor {
    stashed-dispatcher {
      mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox"
    }
    provider = "akka.remote.RemoteActorRefProvider"
    deployment {
      "/*/RemoteChannelRoutingActor" {
        router = round-robin-pool
        nr-of-instances = 2
        target.nodes = ["akka.tcp://MyRemoteSystem@192.168.12.108:2552"]
      }
    }
  }
  remote {
    log-sent-messages = on
    log-received-messages = on
    netty.tcp.port = 2554
    netty.tcp.hostname = "192.168.0.165"
  }
}

slave.conf:

#Akka remote configuration
akka {
  actor {
    stashed-dispatcher {
      mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox"
    }
    provider = "akka.remote.RemoteActorRefProvider"
  }
  remote {
    log-received-messages = on
    netty.tcp {
      hostname = "192.168.12.108"
      port = 2552
    }
  }
}

远程actor由ChronosScheduler类生成:

class ChronosScheduler extends Actor {
  def receive = {
    case ChannelIndex(channelIndex) =>
      context.actorOf(FromConfig.props(Props(new ChannelProcessingActor(channelIndex)).withDispatcher("akka.actor.stashed-dispatcher")), "RemoteChannelRoutingActor") ! "msg"
  }
}

和ChronosScheduler由对象ChronosScheduler生成:

object ChronosScheduler {
  val system =
    ActorSystem("CreationSystem", ConfigFactory.load("master"))

  def sendSpawnCommand = {
    system.actorOf(Props[ChronosScheduler]) ! ChannelIndex(channelIndex)
  }

}

我遇到的错误是:

play.api.Application$$anon$1: Execution exception[[ConfigurationException: configuration problem while creating [akka://CreationSystem/RemoteChannelRoutingActor] with router dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox] and routee dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox]]]
Caused by: akka.ConfigurationException: Configuration missing for router [akka://CreationSystem/RemoteChannelRoutingActor] in 'akka.actor.deployment' section.

有人可以提供有关此错误的任何提示吗? 我认为这是因为类ChronosScheduler doesent可以访问对象ChronosScheduler配置..但无论如何我无法修复它。

SOLUTION:   我遇到的问题是由于我在master.conf中声明RemoteChannelRoutingActor的方式引起的:

  " /*/RemoteChannelRoutingActor "

必须如此:

  "  */RemoteChannelRoutingActor "

0 个答案:

没有答案