how many times does Akka persist a message when us

2019-07-04 01:57发布

问题:

The Akka 2.1 document suggests using the reliable proxy pattern to do guaranteed message delievery, i.e a message is delivery once and only once to the recipient queue. To make sure the message won't lost in case of JVM crashes, I believe the message is stored in persistent queue.

The basic idea is that to send message M from actor A to B, it sends M to two proxy actor P and E, where P is on A's side, and E is on B's side. See this image for detail

Does actor P as well as E need its own persistent queue? A message send from A to B will be persisted in P's queue and E's queue before being persisted in B?

回答1:

The pattern does not concern itself with persistent messages queues: it just aims at making remote delivery as reliable as local delivery (within the unreliability constraints imposed by a fallible network). Thus, when the JVM crashes messages will be lost.

These actors (P and E) do not play well with durable mailboxes, because P stashes the messages internally, i.e. not persistently. It takes them out of the mailbox to do so. You would need to adapt the pattern to have P persist its internal queue instead.



标签: proxy akka