concept fact in category akka

This is an excerpt from Manning's book Akka in Action.
We’ve touched on the fact that we’ll need support capabilities for actors, like remoting and a journal for durability. The ActorSystem is also the nexus for these support capabilities. Most capabilities are provided as Akka extensions, modules that can be configured specifically for the ActorSystem in question. A simple example of a support capability is the scheduler, which can send messages to actors periodically.
An ActorSystem returns an address to the created top-level actor instead of the actor itself. This address is called an ActorRef. The ActorRef can be used to send messages to the actor. This makes sense when you think about the fact that the actor could be on another server.
Listing 4.8. Watching the lifecycle of a dbWriter
class DbWatcher(dbWriter: ActorRef) extends Actor with ActorLogging { context.watch(dbWriter) #1 def receive = { case Terminated(actorRef) => #2 log.warning("Actor {} terminated", actorRef) #3 } } #1 - Watches the lifecycle of the dbWriter #2 - actorRef of terminated actor is passed in Terminated message #3 - Watcher logs the fact that dbWriter was terminated !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[]"} !@%STYLE%@!
Our ultimate goal is to scale to many nodes, and often the starting point is a local app on one node: your laptop. What changes when we want to make the step to one of the distributed topologies discussed in the previous section? Can’t we abstract away the fact that all these nodes run on one “virtual node” and let some clever tool work out all the details so we don’t have to change the code running on the laptop at all? The short answer is no.[1] We can’t simply abstract the differences between a local and distributed environment. Luckily, you don’t have to take our word for it. According to the paper A Note on Distributed Computing,[2] there are four important areas in which local programming differs from distributed programming that can’t be ignored. The four areas are latency, memory access, partial failure, and concurrency. The following list briefly summarizes the differences in the four areas: