Akka remote actors with custom dispatcher

953 Views Asked by At

I'm experiencing difficulties with creating a remote actors with "UnboundedDequeBasedMailbox" I have master machine from what actors are spawned, and slave on which actors will run.

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://[email protected]: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
    }
  }
}

Remote actors is spawn by class 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"
  }
}

and ChronosScheduler is spawn by object ChronosScheduler:

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

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

}

the error i have is this:

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.

Can anyone give any tips on this error, please? I think this happens because class ChronosScheduler doesent have access to object ChronosScheduler config.. but i cannot fix it anyhow.

SOLUTION: The problem i had was caused by manner in which i declared RemoteChannelRoutingActor in master.conf:

  " /*/RemoteChannelRoutingActor "

must be so:

  "  */RemoteChannelRoutingActor "
0

There are 0 best solutions below