Right now if an actor hands off work to another actor, it has to receive the completion from the subordinate in order to set the completion on the original caller. Alternatively you could pass around ActorRefs and have explicit call and response methods instead of relying on Task<T>. Neither option is desirable.
The Completion object already has a Forward method making the former code at least simple to write:
public Task<int> GetSomeInt() {
var completion = Context.GetCompletion<int>();
_subordinate.GetSomeInt().ContinueWith(completion.Forward);
return completion;
}
But it would be even better if there was a method on ActorContext something like:
public Task<int> GetSomeInt() {
return _subordinate.GetSomeInt().Forward(Context);
}
And if this extension method not only did the wiring, but actually removed the intermediate response message but rather relayed the completion message from _suboridinate directly to the inbox of the original caller.
Right now if an actor hands off work to another actor, it has to receive the completion from the subordinate in order to set the completion on the original caller. Alternatively you could pass around
ActorRefs and have explicit call and response methods instead of relying onTask<T>. Neither option is desirable.The
Completionobject already has aForwardmethod making the former code at least simple to write:But it would be even better if there was a method on
ActorContextsomething like:And if this extension method not only did the wiring, but actually removed the intermediate response message but rather relayed the completion message from
_suboridinatedirectly to the inbox of the original caller.