FAQ Database Discussion Community


Workload balancing between akka actors

multithreading,scala,web-crawler,akka,actor
I have 2 akka actors used for crawling links, i.e. find all links in page X, then find all links in all pages linked from X, etc... I want them to progress more or less at the same pace, but more often than not one of them becomes starved and...

Spray Dead Letter msg

scala,akka,actor,spray
I'm trying to execute the following code trait CustomHttpService extends HttpService { import MyJsonProtocol._ import spray.httpx.SprayJsonSupport._ implicit def executionContext = actorRefFactory.dispatcher implicit val timeout = Timeout(5 seconds) val offerActor = actorRefFactory.actorOf(Props[OfferActor], "offer-actor") val defaultRoute = { path("offer" / JavaUUID) { uuid => get { respondWithMediaType(`application/json`) { complete { (offerActor ?...

Why is the actor “ask” pattern considered an anti-pattern or “code smell?”

scala,akka,actor
From what I've gathered, the "ask" pattern is considered a bad practice and should be avoided. Instead, the recommended pattern is the "actor per request" model. However, this doesn't make sense to me, as the "ask" pattern does exactly this - it creates a lightweight actor per request. So why...

Vaadin notification in UI with Akka actor

java,akka,actor,vaadin7
I'm working on integrating an akka actors based backend within a vaadin application. the problem i'm facing is i dare say simple (bear with me i'm a vaadin first timer :P). Project structure (simplified) 2 modules front and backend. my backEnd has an actor system that manages all the backend...

Greenfoot Actor not in World error

object,actor,greenfoot
When my enemy gets to the bottom of the screen I want to remove and if the enemy gets hit by bullets i want to remove it. The error is : java.lang.IllegalStateException: Actor not in world. An attempt was made to use the actor's location while it is not in...

Does Akka natively support Integration Patterns?

apache-camel,akka,actor,thread-synchronization,enterprise-integration
I am new to Akka and am trying to figure out whether it has built-in support for Enterprise Integration Patterns (EIP) or whether I need to delegate this type of routing/integration out to a framework like Camel. In my use case, I have an actor that reads binary samples from...

Importance of Akka Routers

scala,akka,actor
I have this lingering doubt in my mind about the importance of Akka Routers. I have used Akka Routers in the current project I am working on. However, I am a little confused about the importance of it. Out of the two below methods, which is more beneficial. having routers...

Meaning of [email protected] in akka receive

scala,pattern-matching,akka,actor
I was surfing some code examples on akka and I found a particular example that I would like to be sure of the meaning: def receive: Receive = { case [email protected](x) => // do stuff case _ => //do stuff } Ping is a case class used for message in...

Azure service fabric actor dependency injection

actor,azure-service-fabric
Is there any way to inject dependencies in to the Azure Service Fabric Actor's constructor?

Cannot declare template typed actor in C++ Actor Framework

c++,c++11,actor,c++-actor-framework
I'm trying to declare a strongly-typed actor in C++ actor framework (CAF), but my code doesn't compile for some reason. Could you tell me what's wrong with it? #include "caf/all.hpp" template <typename TNum> class DiscoverRequest {}; template <typename TNum> class DiscoverResponse {}; template <typename TNum> class DataRequest {}; template <typename...

UML Number of actors of a Use Case diagram

uml,actor,use-case
Is it possible for a use case to have more than one actor? And if it is, do you know of a good reference where I can find that information (book, webpage) because I am having a problem with a diagram I made for a test. Thanks.

Akka actor cannot send back the message

scala,akka,actor
say, I have an Actor whose receive function likes def receive = { case Message => val doFuture: Future[String] = doSomething() doFuture onSuccess { case doResult => //////////// Here is the problem !! ///////////// // --> here fail. Seems sender cannot send back the result to the caller sender !...

Akka actorSelection vs actorOf Difference

scala,akka,actor
Is there a difference between these two? When I do: context.actorSelection(actorNameString) I get an ActorSelection reference which I can resolve using the resolveOne and I get back a Future[ActorRef]. But with an actorOf, I get an ActorRef immediately. Is there any other vital differences other than this? What might be...

Play - Akka: Actors testing

scala,playframework,akka,actor,akka-testkit
I've read about TestKit, TestActorRef and ImplicitSender provided by Akka. But I didn't found a way to check if a certain actor has received a certain message. I think that "expectMsg(Foo)" can be useful if the receiver-actor does "sender ! Foo". But my application is different: I have an actor...

How to get a reference to an existing ActorSystem in Akka?

scala,akka,actor,spray
is it possible in Akka (scala) to get a reference to an existing ActorSystem? I am working on a Spray application with another Actor for DB. I am also extending Directives to have an object per path. the directives are not actors by themselves, but they need to pass messages...

Use Case: Almost same use case, different actors

uml,case,actor,extends,use
I have one use case "Transfer request" linked to two Actors (Analyst and Inspector). The scenario/exceptions/alternate flow are essentially the same, but for each actor the pre-conditions and post-conditions are different. The request has different states, and that final state and previous states differ depending on the actor that's calling...

Test actors: receive exactly N messages

scala,akka,actor,akka-testkit
I'm testing an application with Akka actors. I'm using Test probes. I want to verify that the probe receives EXACTLY 10 messages of the same type. One solution could be to write 10 times: probe.expectMsg(20 seconds, Done) But I would prefer a more general solution (for example I'd test my...

how to make the program pause when actor is running

multithreading,scala,parallel-processing,actor
For example import scala.actors.Actor import scala.actors.Actor._ object Main { class Pong extends Actor { def act() { var pongCount = 0 while (true) { receive { case "Ping" => if (pongCount % 1000 == 0) Console.println("Pong: ping "+pongCount) sender ! "Pong" pongCount = pongCount + 1 case "Stop" => Console.println("Pong:...

Unable to deserialize ActorRef to send result to different Actor

serialization,apache-spark,actor,spark-streaming
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...

Drools rules not firing from Akka actor system

scala,rest,akka,drools,actor
We've built a Drools module in Scala which runs just fine when called separately, however now we're integrating it into an Akka actor system we've built to be able to fire rules via REST calls. For some reason no rules are firing whatsoever, even blank rules such as: rule "sample...

Akka: Creating many child actors vs. reusing a single child actor

java,akka,actor
I'm quite new to Akka and I have a (hopefully) simple question. I have an actor that needs to repeatedly do a certain small subtask - that is, each time this actor receives a message, it will have to do N subtasks. This subtask is something that I've designated to...

Akka actor granularity

java,akka,actor,thread-synchronization
I am trying to wrap my head around Akka/actors for the first time, and am a bit confused over the granularity of each Actor's responsibilities. In my app there are Widgets that can be registered/unregistered with a WidgetRegistrar. To register itself with the Registrar and Widget is passed to the...

Scala Actors - any suggestions when converting OOP based approach?

scala,oop,concurrency,akka,actor
I'm learning Scala and its Actors (via Akka lib) approach for handling concurrency. I'm having some questions while trying to convert typical OOP (think - Java style OOP) scenarios to Actor based ones. Let's consider the overused e-commerce example Webstore where Customers are making Orders that contain Items. If it...

Chaining Akka Actors in a Spray Route

scala,akka,actor,spray
I have a restful API that receives an array of JSON messages that will be converted to individual Avro messages and then sent to Kafka. Inside the route, I call 3 different actors: 1) one actor goes out and retrieves the Avro schema from disk 2) then loop through the...

Sending behavior within Akka messages

java,akka,actor
Straight from the Akka docs: Actors are made to be containers for behavior and state, embracing this means to not routinely send behavior within messages (which may be tempting using Scala closures). One of the risks is to accidentally share mutable state between actors, and this violation of the actor...

Libgdx Actor undetected touch input

java,libgdx,touch,actor
I am looking for touch detection. The code showed below is what I did to set a circle in my app. I want detect touch on this circle and not around or on the entire texture. The strange thing is that touch isn't detected, in nowhere I can detect it...

libGdx - Scaling group doesn't affect children

java,libgdx,group,actor
I have a group and actors inside of it. I add moving and scaling actions to whole group. Moving works great but I have a problem with scaling - it doesnt affect children. I think there is something wrong with drawing method in my group class but I cant figure...

How to send RabbitMQ messages to Pykka actor?

python,rabbitmq,actor,pika,pykka
How can I listen to a RabbitMQ queue for messages and then forward them to an actor within Pykka? Currently, when I try to do so, I get weird behavior and the system halts to a stop. Here is how I have my actor implemented: class EventListener(eventlet.EventletActor): def __init__(self, target):...

Difference between actor pools and groups in Akka

akka,actor
I'm just starting Akka and I'm trying to understand the difference between actor pools and groups and when to use which. In the doc it briefly says that a group is not created by a router, so that means they don't have a master? In the situation below, can you...