Preservation of the state of Acca in the event of an accident

I start with Akka, and I like the many features it provides for asynchronous programming, such as actors, agents, or futures.

Akka's strong selling point is the fact that when an actor falls, the equivalent actor is recreated by the actor system and locked in place of the old one, guaranteeing strong stability.

Some other systems (they tell me that JMS is one), go ahead and save messages sent between actors continuously. Thus, if a machine crashes physically - say, due to a hardware failure - it is still possible to restore the state as it was before the failure.

This is very attractive for the application I'm currently developing. Does Akka provide such a mechanism? If not, is there a way to integrate it with an external system so that this can be achieved?

+4
source share
2 answers

Strong mailboxes are a good way to save messages selectively, so Akka can accomplish things like JMS. In addition to technology, it is very important to consider at the architecture level which messages are related to your system and how the state should be restored after a system failure.

One way that works well with the acting paradigm is to search for sources. In this concept, the state of your application is stored as a series of events, not the state itself. When a system or part of it fails, the state can be restored by applying all events from the persistent event store. A strong mailbox can be a link to such an event store, or a dedicated actor will be used directly.

Martin Crasser has a very nice article on this blog describing this approach using Akka. He is also the author of an event source extension for Akka named eventsourced .

+5
source

Yes, what you described can be achieved using long-lasting mailboxes , they can be customized as needed based on each actor.

There are several implementations for different back-end, and if you do not find them in your favorite message queue, it will not be very difficult to implement your own adapter. The only implementation we will support in the Akka source tree is FileBasedMailbox , which serves as a template for how to do this. Other types of mailboxes that were in the Akka 2.0.x distribution are supported as community projects by the respective "owners".

+10
source

Source: https://habr.com/ru/post/1438024/


All Articles