通过在 ReceiveAsync 处理程序中故意 awaiting/blocking 创建一种串行操作队列

Create a kind of Serial Operation Queue by intentionally awaiting/blocking in a ReceiveAsync handler

阅读这里: https://petabridge.com/blog/akkadotnet-async-actors-using-pipeto/

The actor’s mailbox pushes a new message into the actor’s OnReceive method once the previous call to OnReceive exits.

其次是

On a ReceiveActor, use ReceiveAsync where T is the type of message this receive handler expects. From there you can use async and await inside the actor to your hearts’ desire.

However, there is a cost associated with this. While your actor awaits any given Task, the actor will not be able to process any other messages sent to it until it finishes processing the message in its entirety. (emphasis mine)

在我看来,我可以利用这种阻塞特性来强制一个Actor成为一种串行操作队列。是的,如果进程崩溃并且排队的消息没有持久化,那将导致这些消息丢失。但是,假设没问题,就我而言,这是可取的。还有其他原因不喜欢这样的演员吗?

Are there any other reasons not to an Actor like this?

你的整体问题在前提上有缺陷,但简短的回答是你应该绝对以这种方式使用 Actors。

您问题中的缺陷是您引用的博客 post 正在谈论使用异步和 PipeTo。您似乎缺少的是所有 Actors 都是这样工作的,无论是同步还是异步,无论是否使用 PipeTo!

Actor 的整个概念(至少在 Akka.Net 中)是围绕一次处理来自邮箱的消息(如您​​所说的 "Serial Operation Queue")构建的。