Akka-Persistence with Queue

(Marc Schlegel) #1

Hello everyone

I am learning Akka by implementing a small integration layer for two microservices. The sole purpose for now is dispatching of events and handling errors.

The basics are running fine so I’ve added some additional behaviour which is able to determine if a external service is unavailable. In this case the behaviour changes to a simple ping, which continually checks the availability until the service is back. During the ping, no domain-events are to that service are dispatched.

Now, I would like to add the capability that no domain-event gets lost. Reading about Akka-Persistence seemed to be exactly what I needed: I can stash messages while waiting for the unavailable service, and unstash them when coming back to life.
Unfortunately the default storage for akka-persistence (as far as I understood) is an event-store with the purpose of replaying events to recreate state. In my case however I am more interested in an actor which can stash/unstash messages using a persistent queue.

Is there any configuration in Akka-Persistence or do I have to roll my own implementation? I found this blog from 2014 which seems to be what I am looking for, but there is a lot of custom code