Coroutine-based actor interface for asynchronous message processing. More...
#include <actor.hpp>
Public Member Functions | |
| void | Receive (TMessageId messageId, TBlob blob, TActorContext::TPtr ctx) override |
| IActor bridge — invokes CoReceive and parks pending futures. | |
| virtual TFuture< void > | CoReceive (TMessageId messageId, TBlob blob, TActorContext::TPtr ctx)=0 |
| Asynchronous message handler (override in subclass) | |
Additional Inherited Members | |
Public Types inherited from NNet::NActors::IActor | |
| using | TPtr = std::unique_ptr< IActor > |
Coroutine-based actor interface for asynchronous message processing.
Extends IActor so that CoReceive can co_await timers, Ask, or I/O without blocking the event loop thread.
One async handler at a time. When CoReceive returns a pending TFuture<void>, the actor's mailbox is paused: no further messages are dispatched until that future completes. This removes the need for internal locking — state can be mutated freely inside the handler.
|
pure virtual |
Asynchronous message handler (override in subclass)
May freely use co_await ctx->Sleep(...), co_await ctx->Ask<T>(...), or any other coroutine primitive. While this coroutine is suspended, the actor's mailbox is paused — subsequent messages queue up and are delivered only after this handler returns (i.e. its future completes).
| messageId | Type identifier of the incoming message |
| blob | Serialized message payload |
| ctx | Actor context (valid for the duration of this handler) |
|
overridevirtual |
IActor bridge — invokes CoReceive and parks pending futures.
Called by the actor system. Not meant to be overridden; override CoReceive instead.
Implements NNet::NActors::IActor.