1

我在使用“UnboundedDequeBasedMailbox”创建远程演员时遇到了困难,我拥有生成演员的主机,以及将在哪个演员上运行的奴隶。

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 类没有访问对象 ChronosScheduler 配置的权限。但我无论如何都无法修复它。

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

  " /*/RemoteChannelRoutingActor "

必须是这样:

  "  */RemoteChannelRoutingActor "
4

0 回答 0