Akka通过负载均衡器询问 [英] Akka ask through a load balancer
问题描述
我有以下设置:
[app-a Containers] <-[load balancer]-> [app-b Containers]
这些容器是Docker容器,并且为一组容器分配了DNS名称,例如app-a.marathon.mesos
和app-b.marathon.mesos
.
The containers are Docker containers and a set of containers are assigned a DNS name like app-a.marathon.mesos
and app-b.marathon.mesos
.
现在,当app-a
中的演员向app-b
上的远程演员提问时,app-b
的发件人将成为app-a.marathon.mesos
.
Now when an actor in app-a
makes an ask to a remote actor on app-b
, the app-b
's sender becomes app-a.marathon.mesos
.
这是一个很大的问题,因为现在,对提问者的答复可能会或可能不会到达–它可能会到达任何app-a
容器.
This is tremendously problemmatic because now, the reply to the asking actor may or may not arrive – it may arrive at any of the app-a
containers.
克服此问题的最佳方法是什么?
What is the best way to overcome this?
推荐答案
您的设置似乎实际上无法实现您的目标,因为违反了基本约束,即actor路径是唯一的这一事实. 我认为有2种选择:
Your setup seems to make it actually impossible to implement your goal because a basic constraint, the fact that the actor path is unique is violated. I think there are 2 options:
-
更新您的负载均衡器以支持某种特定的寻址方式
Update your load balancer to support some kind of specific addressing
在收到答案后将要在app-a上执行的后续操作编码为消息本身,从而允许app-b实际执行它们(或app-a中的随机接收者). /p>
Encode the follow-up operations you want to execute on app-a upon receiving the answer into the message itself, allowing the app-b to actually execute them (or the random receiver in app-a).
这篇关于Akka通过负载均衡器询问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!