[英]Kotlin actor to actor communication
An actor can be sent a message with actor.send()
or actor.offer()
Once my actor gets the message from its channel I'd like to return a response. 可以使用
actor.send()
或actor.offer()
向actor发送消息。一旦我的actor从其频道获取消息,我想返回响应。 How do I do this? 我该怎么做呢? I don't see any obvious built in method.
我没有看到任何明显的内置方法。
You need to request the Actor
's channel
, as documented : 你需要要求
Actor
的channel
,为记录 :
[The
actor
coroutine builder] Launches new coroutine that is receiving messages from its mailbox channel and returns a reference to the coroutine as anActorJob
.[
actor
coroutine builder]启动从其邮箱通道接收消息的新协程,并作为ActorJob
返回对协同程序的ActorJob
。 The resulting object can be used to send messages to this coroutine.生成的对象可用于向此协程发送消息 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.