6

Can an Akka actor store its outgoing messages in a local durable outbox until its remote receiver actor is ready to receive them in its own durable inbox? In other words, can I use Akka to perform store-and-forward style messaging similar to e-mail?

Derek Mahar
  • 27,608
  • 43
  • 124
  • 174

3 Answers3

6

You can do that with reliable channels of Eventsourced. Eventsourced is an event sourcing library for Akka.

Martin Krasser
  • 745
  • 5
  • 13
3

I second Martin’s answer: Akka actors are meant to form the basic building block on which more complex things can be built, and Martin’s library is an excellent example of that. Providing more and more of that functionality within the “foundation” is something we tried a few years ago and reverted, instead keeping it lean and focused.

Roland Kuhn
  • 15,412
  • 2
  • 36
  • 45
2

You can adopt Akka Reliable Proxy pattern (http://doc.akka.io/docs/akka/snapshot/contrib/reliable-proxy.html) by adding some kind of message persistence to it.

Moreover you can create your own Durable Mailbox which can persist messages to DB with addition of message state, timestamp and target actor type (it's also can solve problem with Durable Mailboxes for Routees of a Resizable Router). And you can use this storage for your Reliable Proxy too (also using timestamp and TARGET actor type). In this case you can recover timed out messages from dead cluster nodes by alive actors of the same type.

We use such mechanism in our project, our Durable Mailboxes also support acknowledgement mode and we can recover messages timed out during processing (if an actor dies during processing the message). Just don't forget about maxFailures (in case of acknowledgement mode) and don't persist PoisonPill / Kill messages.

  • Hi sergiy.have you write your own implementation for the durable mailbox on db or did you find one already ready to use? – omartin Jun 05 '13 at 06:19
  • I've written my own implementation backed by MongoDB. I plan to share it after some refactoring/beautification (when I'll have enough time for this). – Sergiy Prydatchenko Jun 05 '13 at 08:52