The pattern itself is called MessageStore - http://www.eaipatterns.com/MessageStore.html and essentially describes how message durability can be achieved in messaging systems where messages could accumulate before they are processed. The default mailbox in Akka is backed by an in-memory queue - ConcurrentLinkedQueue. This means that in the event of a re-start the un-processed messages that were in the mailbox during the shutdown/crash will be lost.
So, I think what you are looking for is durable mailbox - a mailbox backed by some persistence mechanism. Aside from implementing your own, Akka currently supports several (e.g., File, Redis, Mongo etc). You can read more here http://doc.akka.io/docs/akka/2.0/modules/durable-mailbox.html Having said that, achieving message durability thru durable mailboxes could be costly. Another way of solving the issue you describe is through acknowledgments and message re-delivery. In other words a source system is kept aware thru some mechanism about which messages have been processed vs which are still in process. But this could create a message ordering issue. But giving the fact that you are storing your messages (events) in Mongo, I think ordering would not be a big issue as long as you maintain correct document id (ObjectId) Hope that's what you are looking for. Oleg On Sun, Jan 19, 2014 at 3:07 PM, Peter Wolf <[email protected]> wrote: > Hello, > > I am using Actor to log events to Mongo. Sometimes the events come in > faster than they can be processed. I don't want to lose any. > > I have read the docs on MessageBoxes, and Actor should easily be able to > handle this. However, I can't be the first, and I don't want to reinvent > the wheel. > > Is there a good pattern for this problem? Are there any example or > tutorials? > > Thanks > Peter > > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://akka.io/faq/ > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/groups/opt_out. > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
