How to recover messages in Akki Actors now that deleted mailboxes are deleted?

I was working with the latest version of Akka when I noticed that strong mailboxes have now been removed from Akka.

I need to make sure my messages recover after a reboot after a failure. Is there an alternative way to work without reliable mailboxes or a custom implementation by someone else.

I also tried Akka Persistence, but it repeats the messages, and I do not want to send the same messages twice in the event of a failure, given that all messages are expensive to execute.

+7
scala akka
source share
2 answers

Although this is not really a solution for working with Akka Actors, it solves the original problem that is discussed here.

Instead of using Akka here, I find it better to use something like Kafka along with reactive threads with something like akka/reactive-kafka .

Such a system is very good for persistence and offers very good semantics for maintaining the message queue in case of failure. This is better than storing a message somewhere that needs to be processed, and generally works better.

It should not be Kafka, but any backend that can connect with a reactive stream (Akka implementation or otherwise).

+1
source share

Akka Persistence plays events created based on the received commands. Events are generated from command messages after verification and cannot create unacceptable states of actors.

This means that the original received messages (commands) are not necessarily reproduced, but you can save events that are cheaper to use to restore the state of an actor after a failure. Alternatively, you can use snapshots to restore state directly.

Edit: As already mentioned, in the comments it is true that only the state of the actor is saved and is in disaster. This state reflects only consumed messages, and not those that are still in the participants' inbox.

However, instead of pushing messages to an actor, who will then be stored in a secure mailbox, an alternative could be a β€œrecipient” to pull messages from a regular participant who keeps a list of messages as part of their state.

UntypedPersistentActorWithAtLeastOnceDelivery as part of akka persistence offers another option when the sender takes care of persistent messages.

I understand that this is not a replacement for reliable mailboxes, since they require a rethinking of the system. So far, work with consumers has worked. Initially, we also looked at message queue products (RabbitMQ with strong queues), but since our initial work items were taken from db, we can handle the aka avaka without lengthy messages.

-one
source share

All Articles