When an actor confers with another to use its services—most likely on a remote actor system—you will always have to handle the case that the other actor goes away. Either it terminates or the node crashes or the network connection fails, sooner or later something will go wrong. Instead of making dedicated network monitoring available, Akka follows a more general approach, focusing on the service you need instead of on the implementation details.

It is quite simple: when the service goes down it will stop responding. DeathWatch can be used to condense the various reasons why this may happen into a single Terminated message. The actor which wanted to talk to that other actor will then have to keep retrying until the manually handled restart has occurred. Here you can see a prototypical implementation of an actor providing this functionality:

Note how none of this is specific to remoting, this also applies when talking to a local actor which might terminate and be recreated. That is what we call Location Transparency.

A variant of this actor would not stash but simply drop all messages in the waiting state, or it could contain a bounded internal queue which drops the oldest message on overflow; the details are up to your specific use-cases.

Share


Discuss


View All Posts or Filter By Tag


Event

Reactive Summit 2016

MICROSERVICES. FAST DATA PIPELINES. DISTRIBUTED SYSTEMS.
Austin (TX) - October 4-5

Ebook

Reactive Microservices Architecture

by Jonas Bonér

Ebook

Developing Reactive Microservices

by Markus Eisele

Report

Going Reactive 2016

How Microservices & Fast Data are driving adoption of Reactive systems