【发布时间】:2014-10-02 21:43:44
【问题描述】:
是否可以在 Akka.Net Actor 计算中的 Async 上等待(不阻塞)?我想实现类似于以下的目标。
actor {
let! msg = mailbox.Receive()
match msg with
| Foo ->
let! x = async.Return "testing 123" // Some async function, return just an example
() // Do something with result
}
【问题讨论】:
-
基于此:github.com/akkadotnet/akka.net/blob/… 如果 Akka.net 选择在那里重新配置他们自己的 AsyncBuilder 似乎很合适......所以不,你不能在那里使用 F# 的 Asyncs 助手(F# 中没有 Monad-Transformers ) - 当然,您可以尝试将您需要的内容重新添加到 Akka 的
Cont中(使用 Async.StartWithContinuations)