简体   繁体   English

Akka消息订单

[英]Akka message order

According to the Akka documentation ( Message Delivery Reliability - General Rules ), the message order is preserved for a given sender-receiver pair. 根据Akka文档( 消息传递可靠性 - 一般规则 ),为给定的发送者 - 接收者对保留消息顺序。 The ActorRef.tell(Object msg, ActorRef sender) method allows one to set another actor as the sender of the message. ActorRef.tell(Object msg, ActorRef sender)方法允许将另一个actor设置为消息的发送者。 So my question is: Who is the sender in the sender-receiver pair, for which the order is preserved if the sender of the ActorRef.tell is not set to self() but to the ActorRef of another actor? 所以我的问题是:谁是发送者 - 接收者对中的发送者,如果ActorRef.tell的发送者没有设置为self()而是设置为另一个actor的ActorRef,则保留订单?

Which message order guarantees apply, if some code, which is not running in the context of an actor (eg, interface thread), sends a message to an actor via ActorRef.tell and sets the sender to either ActorRef.noSender() or any other ActorRef ? 哪些消息顺序保证适用,如果某些代码(未在actor的上下文中运行(例如,接口线程))通过ActorRef.tell向actor发送消息并将发送者设置为ActorRef.noSender()或任何其他ActorRef

You could think of sender as sending thread, rather than sender ActorRef , so regardless of what you pass as sender ActorRef the messages will be place in the inbox in the order you called tell in that thread. 您可以将sender视为发送线程,而不是发送方ActorRef ,因此无论您作为发送方ActorRef传递的是什么,消息都将按照您在该线程中调用tell的顺序放置在收件箱中。 Other threads doing tell could be sandwiched in any way with the tell calls of your thread, so this is what the sender -> receiver ordering guarantee refers to. 执行tell其他线程可以用你的线程的tell调用以任何方式夹在中间,所以这就是sender -> receiver排序保证引用的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM