remote-actors

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

爱⌒轻易说出口 提交于 2019-12-06 09:46:04
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]) } The client: object Client extends App { // client code val actor = remote.actorFor( "hello-service",

How to discover that a Scala remote actor is died?

霸气de小男生 提交于 2019-12-05 20:48:43
问题 In Scala, an actor can be notified when another (remote) actor terminates by setting the trapExit flag and invoking the link() method with the second actor as parameter. In this case when the remote actor ends its job by calling exit() the first one is notified by receiving an Exit message. But what happens when the remote actor terminates in a less graceful way (e.g. the VM where it is running crashes)? In other words, how the local actor can discover that the remote one is no longer

Akka remote actors, superclass without default constructor

吃可爱长大的小学妹 提交于 2019-12-05 08:13:24
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("Sender", ConfigFactory.load.getConfig("sender")) val actor = system.actorFor("akka://Receiver@127.0.0.1

How can I identify a remote actor?

送分小仙女□ 提交于 2019-12-05 02:01:37
问题 I have a remote actor (client) which is registering with another remote actor (server) and then later deregistering (with a shutdown hook). However, although the server picks up the de-registration, the actual sender property is a different Channel object ; so in my server logs I have: Registered new client [scala.actors.Channel@158e282]; supporting 1 clients De-registered client [scala.actors.Channel@1caf0b6]; supporting 1 clients How can I determine (on the server side) that this was the

RemoteActor.select - result deterministic?

a 夏天 提交于 2019-12-04 19:56:49
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 scala.actors.remote._, RemoteActor._ object DelegateTest { def main(args :Array[String]) { val actor = new

RemoteActor unregister actor

倾然丶 夕夏残阳落幕 提交于 2019-12-04 12:15:24
I'm playing with RemoteActors. Now I wonder, what happens if I shut down an RemoteActor. The actor was made available with RemoteActor.alive and RemoteActor.register. I can't find the inverse of either of both: alive and register. How do I properly shut down an RemoteActor? Update To make it more obvious, I made a 'small' example. Neither of the following 2 programs terminate, the JVM keeps running. All user created actors and main are finished. package test import scala.actors.{OutputChannel, AbstractActor, Actor} , Actor._ import scala.actors.remote.RemoteActor , RemoteActor._ object

Why are case objects serializable and case classes not?

[亡魂溺海] 提交于 2019-12-03 12:08:28
问题 I am playing with this example http://scala.sygneca.com/code/remoteactors to learn how remote actors work in Scala (2.8.0). In particular I slightly modified how the messages send by the actors are defined as it follows: sealed trait Event extends Serializable case object Ping extends Event case object Pong extends Event case object Quit extends Event and everything works as expected. Unfortunately if I define the events as case classes instead of case objects as in: sealed trait Event

Why are case objects serializable and case classes not?

ぐ巨炮叔叔 提交于 2019-12-03 02:40:38
I am playing with this example http://scala.sygneca.com/code/remoteactors to learn how remote actors work in Scala (2.8.0). In particular I slightly modified how the messages send by the actors are defined as it follows: sealed trait Event extends Serializable case object Ping extends Event case object Pong extends Event case object Quit extends Event and everything works as expected. Unfortunately if I define the events as case classes instead of case objects as in: sealed trait Event extends Serializable case class Ping extends Event case class Pong extends Event case class Quit extends