remote-actors

Why is setting the classloader necessary with Scala RemoteActors?

北城以北 提交于 2020-01-03 14:14:22
问题 When using Scala RemoteActors I was getting a ClassNotFoundException that referred to scala.actors.remote.NetKernel. I copied someone else's example and added RemoteActor.classLoader = getClass.getClassLoader to my Actor and now everything works. Why is this necessary? 回答1: Remote Actors use Java serialization to send messages back and forth. Inside the actors library, you'll find a custom object input stream ( https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/actors/scala/actors

Why is setting the classloader necessary with Scala RemoteActors?

天大地大妈咪最大 提交于 2020-01-03 14:14:13
问题 When using Scala RemoteActors I was getting a ClassNotFoundException that referred to scala.actors.remote.NetKernel. I copied someone else's example and added RemoteActor.classLoader = getClass.getClassLoader to my Actor and now everything works. Why is this necessary? 回答1: Remote Actors use Java serialization to send messages back and forth. Inside the actors library, you'll find a custom object input stream ( https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/actors/scala/actors

Reply is not transmitted back to the 'client'-actor

丶灬走出姿态 提交于 2020-01-02 10:02:58
问题 I've an unexpected behavior when using remote actors. I've a server and a 'client'. The client sends a message to the server actor and the server replies. When I use the '?' operator everything works as expected. I get the answer back from the server. The server: class HelloWorldActor extends Actor { def receive = { case msg => self reply (msg + " World") } } object Server extends App{ Actor.remote.start("localhost",2552); Actor.remote.register("hello-service",Actor.actorOf[HelloWorldActor])

From where we get sender actor when a particular message is received?

三世轮回 提交于 2020-01-01 05:25:05
问题 Whenever an actor receives a message in scala, we can access the sender of the actor by using a keyword 'sender' which is an an object of trait AbstractActor. My question how is this 'sender' becoming accessible whenever a message is received.? and also, can we override this implementation where along with sender some other data is also accessible such as ipaddress, port from where the data came . As far as i know, there is no way you can get ipaddress and port from where the message has come

Scala akka ActorFor path

烈酒焚心 提交于 2019-12-24 10:59:40
问题 Here is my code for finding an actor on my remote system: Application.system.actorFor("akka://ActorApplication@172.17.100.232:2552/home/louis/scala/remoteActor") I think I have the wrong path specified. Is this correct: /home/louis/scala/ Is the location of the Play! project on the remote server. And then "remoteActor" is the name if the actor. But it is never returning an ActorRef object, it is always null. 回答1: no, the address should likely be: "akka://ActorApplication@172.17.100.232:2552

Akka remote actors, superclass without default constructor

允我心安 提交于 2019-12-22 05:23:18
问题 I am trying to send a message using akka remote actors, where the case class is a subclass of a superclass taking argument in its constructor. Here is a minimum example to reproduce the problem: package com.tuvistavie.testremote import akka.actor.{ Actor, ActorSystem, Props, ActorLogging } import com.typesafe.config.ConfigFactory abstract class Foo(val a: Int) case class MessageFoo(override val a: Int) extends Foo(a) object Sender { def main(args: Array[String]) { val system = ActorSystem(

Akka 2.1 minimal remote actor example

孤街浪徒 提交于 2019-12-17 22:37:25
问题 EDIT Notice, I needed to make the reverse changes of this https://github.com/akka/akka/commit/ce014ece3568938b2036c4ccfd21b92faba69607#L13L6 to make the accepted answer work with AKKA 2.1 which is the stable distribution found on akkas homepage! I have read all the tutorials I could find on AKKA, but nothing I found works "out of box". Using eclipse, I want to create 2 programs. Program1: starts actor "joe" and somehow makes it available on 127.0.0.1:some_port Program2: gets a reference to

Create an Akka actor remotely without a new ActorSystem

Deadly 提交于 2019-12-08 01:16:31
问题 I've been over the documentation several times now (http://doc.akka.io/docs/akka/2.1.4/scala/remoting.html) and through the example here (https://github.com/akka/akka/tree/master/akka-samples/akka-sample-remote) and through others, and I still can't figure out how to do what I want to do. The closest answer I've found is this: how to start remote actors in scala, but it seems much more inconvenient than I'd think it would be. I have a cluster of 12 machines to work on. I would like to

RemoteActor.select - result deterministic?

北城以北 提交于 2019-12-06 14:29:18
问题 I wonder if there is any determinism when calling val delegate = RemoteActor.select(). I'm asking this, because I noticed that the program doesn't terminate, when I'm sending delegates over the net. Are there any other side effects, which depend on the delegate? Are there any rules, when RemoteActor.select will return the same delegate for the same arguments? Here's some example code which demonstrates the RemoteActor.select problem: package test import scala.actors.Actor, Actor._ import

Create an Akka actor remotely without a new ActorSystem

浪尽此生 提交于 2019-12-06 14:12:37
I've been over the documentation several times now ( http://doc.akka.io/docs/akka/2.1.4/scala/remoting.html ) and through the example here ( https://github.com/akka/akka/tree/master/akka-samples/akka-sample-remote ) and through others, and I still can't figure out how to do what I want to do. The closest answer I've found is this: how to start remote actors in scala , but it seems much more inconvenient than I'd think it would be. I have a cluster of 12 machines to work on. I would like to something along the lines of: val system = ActorSystem("DistributedSystem", ConfigFactor.load.getConfig(