Akka Notes - DeathWatch - 7

When we talked about Actor lifecycle, we saw that Actors could be stopped by various means (using ActorSystem.stop or ActorContext.stop or sending a PoisonPill - there's also the Kill and the gracefulStop). Whatever reason an Actor dies, there are cases when a few other actors in the system…

Akka Notes - Child Actors and ActorPath - 6

Actors are completely hierarchical. Whatever Actors that you create HAS to be a child of some other Actor. Let's analyze that a bit : Path Say, we create an ActorRef using ActorSystem.actorOf and try to print its path. val actorSystem=ActorSystem("SupervisionActorSystem") val actorRef=actorSystem.actorOf(Props[BasicLifecycleLoggingTeacherActor]) println (actorRef.…

Akka Notes - Actor Lifecycle - Basic - 5

(Please note that this lifecycle write-up does not cover the preRestart or the postRestart methods. We'll talk about them when we discuss supervision) The basic Actor lifecycle is very much intuitive. You could actually compare the basic Actor lifecycle with a Java servlet lifecycle with one special difference. 1. Just…

Akka Notes - ActorSystem (Configuration and Scheduling) - 4

As we saw from our previous posts, we could create an Actor using the actorOf method of the ActorSystem. There's actually much more you could do with ActorSystem. We'll touch upon just the Configuration and the Scheduling bit in this write-up Let's look at the subsets of methods available in…

Akka Notes - Actor Messaging - Request and Response - 3

Last time when we saw Actor messaging, we saw how fire-n-forget messages are sent (Meaning, we just send a message to the Actor but don't expect a response from the Actor). Technically, we fire messages to Actors for its side-effects ALL THE TIME. It is by design. Other than not…

Akka Notes - Logging and Testing Actors - 2

In the first two parts (one, two), we briefly talked about Actors and how messaging works. In this part, let's look at fixing up Logging and Testing our TeacherActor. Recap This is how our Actor from the previous part looked like : class TeacherActor extends Actor { val quotes = List( "Moderation is…

Akka Notes - Actor Messaging - 1

From the introductory first part of the Akka Notes, we saw a bird's eye view of Actors in the Akka Toolkit. In this second part of the Akka Notes, we'll look at the messaging part of Actors. As for the example, we would use the same Student-Teacher example that we…

Akka Notes - Introducing Actors

Anyone who has done multithreading in the past won't deny how hard and painful it is to manage multithreaded applications. I said manage because it starts out simple and it became a whole lot of fun once you start seeing performance improvements. However, it aches when you see that you…