# How to build a durable mailbox with Akka Persistence?

**URL:** <https://discuss.akka.io/t/how-to-build-a-durable-mailbox-with-akka-persistence/6500>\
**Category:** Persistence / Event Sourcing\
**Created:** [May 14, 2020, 12:30pm UTC](https://discuss.akka.io/t/how-to-build-a-durable-mailbox-with-akka-persistence/6500 "2020-05-14T12:30:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gowtham](https://avatars.discourse-cdn.com/v4/letter/g/b4bc9f/32.png) [@gowtham](https://discuss.akka.io/u/gowtham)\
**Post date:** [May 14, 2020, 12:30pm UTC](https://discuss.akka.io/t/how-to-build-a-durable-mailbox-with-akka-persistence/6500/1 "2020-05-14T12:30:00Z")

</div>

I have a scenario where we have an EventProcessor actor which has a rate limit on how many events it can process per second.

So, when we _tell_ to the EventProcessor actor, messages get queued up in mailbox because of the rate limit.

So, when the system is restarted the messages in the mailbox will be lost. There should, therefore be a way of persisting the events in the mailbox and **replay only those** events which are **yet to be processed**.

Using, Akka Persistence, I thought of doing like this…

1. Event source
2. PersistentActor
3. EventProcessorActor

**Flow:**

1. The EventSource which is **not an actor** , will **tell** the PersistentActor to persist the messages.
2. The PersistentActor will persist the messages and **tell** the EventProcessor actor to process them.
3. The EventProcessor will process those messages and will **tell** the PersistentActor to delete the message which it has finished processing.
4. The PersistentActor will receive the message from the EventProcessor about the message that has been processed and remove it from the persistence layer.

Is there any working example?

Regards,  
Gowtham

---

<div class="post-metadata">

**Author:** ![watimuma](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/watimuma/32/2947_2.png) [@watimuma](https://discuss.akka.io/u/watimuma)\
**Post date:** [October 19, 2022, 6:24am UTC](https://discuss.akka.io/t/how-to-build-a-durable-mailbox-with-akka-persistence/6500/2 "2022-10-19T06:24:43Z")

</div>

hi,has Mailbox Persistence been solved?I had the same problem.

---

<div class="post-metadata">

**Author:** ![leviramsey](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/leviramsey/32/2653_2.png) [@leviramsey](https://discuss.akka.io/u/leviramsey)\
**Post date:** [November 2, 2022, 12:53pm UTC](https://discuss.akka.io/t/how-to-build-a-durable-mailbox-with-akka-persistence/6500/3 "2022-11-02T12:53:16Z")

</div>

There’s [Reliable Delivery](https://doc.akka.io/docs/akka/current/typed/reliable-delivery.html), though one should be aware of the severe performance implications.
