actor

Unable to deserialize ActorRef to send result to different Actor

天大地大妈咪最大 提交于 2019-12-05 14:12:29
I am starting to use Spark Streaming to process a real time data feed I am getting. My scenario is I have a Akka actor receiver using "with ActorHelper", then I have my Spark job doing some mappings and transformation and then I want to send the result to another actor. My issue is the last part. When trying to send to another actor Spark is raising an exception: 15/02/20 16:43:16 WARN TaskSetManager: Lost task 0.0 in stage 2.0 (TID 2, localhost): java.lang.IllegalStateException: Trying to deserialize a serialized ActorRef without an ActorSystem in scope. Use 'akka.serialization.Serialization

Strange behavior: Scala Actors 2.7.7 vs. 2.8-Snapshot

不打扰是莪最后的温柔 提交于 2019-12-05 12:35:40
I'm an 18 years old trainee and I'm discovering scala which I like very much :-). To get familiar with the scala actors I wrote a small simulation with some gears and one controller. The ActorApplication creates N gears with random speed. The controller calculates a synchronization speed and starts the gear-actors. The gears synchronize to this given speed step by step (1+ or 1-). The simulation is finished when all gears have reached the synchronization speed. I developed the simulation in scala 2.7.7 - and it worked as I expected it (see output below). However, when I swichted to the current

Dead-letter in Akka Scala actors

心已入冬 提交于 2019-12-05 12:15:47
I have a very simple structure based on Akka actors in Scala, but I keep on receiving warnings about undelivered messages. This is the code for the main class, Collector is a separate class extending Actor: object Executor extends App { class ExecutorMaster extends Actor { def receive() = { case _ => Executor.actorSystem.actorOf(Props[Collector], name = "Collector") ! true } } val actorSystem = ActorSystem("ReadScheduler") private val app = actorSystem.actorOf(Props[ExecutorMaster], name = "Executor") app ! true } The message is not being delivered to the Collector, the result for the code is:

Tracing the action of consuming messages from mailbox in Erlang

♀尐吖头ヾ 提交于 2019-12-05 10:14:05
I went through the documentation of the trace/3 BIF in Erlang. However, one observation I have made is that it cannot be used for tracing the consuming of messages from the mailbox. The flag 'receive' only traces when messages are added to a process's mailbox. Is there any way one can trace events such as reading from the mailbox using the receive construct? If not, is there any reason why this isn't possible? It seems very strange that one can trace most kind of events in a program and the reading of messages from a mailbox is not traceable. There is no such tool. You can only hope for call

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

In which way is akka real-time?

别等时光非礼了梦想. 提交于 2019-12-05 07:03:47
At a couple of places there is state that akka is somehow "real-time". E.g.: http://doc.akka.io/docs/akka/2.0/intro/what-is-akka.html Unfortunately I was not able to find a deeper explanation in which way akka is "real-time". So this is the question: In which way is akka real-time? I assume akka is not really a real-time computing system in the sense of the following definition, isn't it?: https://en.wikipedia.org/wiki/Real-time_computing No language built on the JVM can be real-time in the sense that it's guaranteed to react within a certain amount of time unless it is using a JVM that

How to determine the number of actors to spawn in akka?

爷,独闯天下 提交于 2019-12-05 04:30:03
问题 I have recently started looking into the Akka 2.0 framework and was able to get some code running, spawning actors that perform simple oracle database calls, performing simple calculations and whatnot, nothing in production however. What I want to know, is there a general rule of thumb or best practice to determining how many actors to spawn for certain types of tasks? Say for example, I have a connection pool of 200 jdbc connections, Do I create an actor to represent each connection? Do I

Client-Server example with Scala actors

空扰寡人 提交于 2019-12-05 04:25:14
What is the best way to implement the following example ? Actor server receives Requests , handles them, creates a new Response for each Request and sends the Response back to the Request sender. Actor client sends Requests and receives Responses . All this communication is asynchronous and hence it uses react . This is just an example and so it should not handle all those cases like server is down, client is stuck, etc. It should be just concise and expressive. import scala.actors._ import Actor._ case class SendRequest(rid: String) case class Request(rid: String) case class Response(rid:

Does a wait on Scala Future block thread?

风流意气都作罢 提交于 2019-12-05 04:14:20
When I wait for result of Scala Future, does it behave more like receive , or like react , i.e. does it block a thread, or schedules a continuation after result if available? Vasil Remeniuk Yes, in stdlib it blocks the thread, and synchronously waits for results. If you want to apply continuation-passing style to futures, you'd have to use Akka or Scalaz that allow adding hooks on futures completion straight from the box. Akka : val f1 = Future { Thread.sleep(1000); "Hello" + "World" } val f2 = f1 map { _.length } f2 foreach println //Done asynchronously and non-blocking Same with Scalaz :

Akka actor lookup or dependency injection

梦想的初衷 提交于 2019-12-05 03:42:59
I'm just starting to work with Akka and I can't decide if I should use dependency injection (like cake pattern) or actor lookup in order to decouple the actors from each others. What is the preferred method? You should prefer to introduce actors to each other, which means to send an ActorRef in or with a message or to pass it into a constructor. The latter may involve the cake pattern of you so choose, but lookup is much more expensive and therefore you should use real ActorRef whenever possible. 来源: https://stackoverflow.com/questions/17770900/akka-actor-lookup-or-dependency-injection