使用Akka Persistence和Extra-Cameo模式进行至少一次交付

栏目: Scala · 发布时间: 6年前

内容简介:我正在开发一个使用Akka的应用程序,其中Actors旨在避免请求 – 响应模式.使用Extra或Cameo模式可以将actor之间的交互建模为消息的“流”.下图总结了这些演员的架构.

我正在开发一个使用Akka的应用程序,其中Actors旨在避免请求 – 响应模式.使用Extra或Cameo模式可以将actor之间的交互建模为消息的“流”.

下图总结了这些演员的架构.

使用Akka Persistence和Extra-Cameo模式进行至少一次交付

Cameo模式用于处理来自SK演员的响应.

现在,想象一下,我想保证SF和SK演员之间的至少一次语义.我怎样才能做到这一点?使用Akka持久性实现ato语义需要在这些actor之间实现请求 – 响应模式.

如何确保使用Cameo处理响应的actor之间至少有一次语义?

非常感谢

杰米艾伦帮助我在Twitter上回答这个问题. Twitter对话是 this

.

我试着总结杰米所说的讨论.

For reliable at-least-once, using Akka Cluster and Persistence to get it done is possible, but probably overkill. I say try to keep it simple. Have a GUID for the request, and send it with the request to the three SKs.
In the immutable ledger scenario, you’d then occasionally sweep the ledger to get rid of dups by GUID. How consistent that data needs to be will define that.
Simplicity is going to be a lot easier to maintain & avoid partial failures. You can handle idempotency on the SK side one of a few ways: either track all GUIDs when the requests are processed via an expiring cache, or store the GUIDs with the immutable updates in a ledger.

因此,在这种情况下,更好的解决方案是完全删除Akka Persistence并将问题减少到良好的旧消息传递.

SF向SK演员发送消息,Cameo节点等待SKs响应.如果此类反应未在预定的时间窗口内到达,则Cameo节点使用超时消息警告SF. SF再次向SKs演员重新发送消息.

代表上述解决方案的图表如下.

使用Akka Persistence和Extra-Cameo模式进行至少一次交付

标有数字5的红色消息模拟超时消息.

正如杰米所说:

I think ACK has to be the responsibility of the caller, all the way back to the sender of the original request. That’s the safest & simplest approach.

希望能帮助到你.

翻译自:https://stackoverflow.com/questions/48201333/at-least-once-delivery-using-akka-persistence-and-the-extra-cameo-pattern


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

别具光芒

别具光芒

李烨 / 2008-10 / 59.00元

《别具光芒CSS属性、浏览器兼容与网页布局》结合大量范例与实际应用的实例,详细介绍了W3C发布的层叠样式表CSS2.1规范,浏览器对于CSS2.1规范解释的异同,以及使用XHTML和层叠样式表对网页进行结构化与美化的实际制作方法。《别具光芒CSS属性、浏览器兼容与网页布局》内容由浅入深,不仅介绍了Web标准和层叠样式表的各个属性,还结合实例对属性的实际应用进行讲解,同时配合在不同浏览器内的效果展示......一起来看看 《别具光芒》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具