gpt4 book ai didi

scala - Scala 中的 Akka,感叹号和问号

转载 作者:行者123 更新时间:2023-12-03 05:36:39 29 4
gpt4 key购买 nike

向 Actor 发送消息时,感叹号 (!) 和问号 (?) 有什么区别?

myActor ! Hello(value1)
myActor ? Hello(value1)

最佳答案

无耻地复制[太棒了] official doc (查看发送消息部分了解更多信息):

Messages are sent to an Actor through one of the following methods.

! means “fire-and-forget”, e.g. send a message asynchronously and return immediately. Also known as tell.

? sends a message asynchronously and returns a Future representing a possible reply. Also known as ask.

关于scala - Scala 中的 Akka,感叹号和问号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17644273/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com