Skip to content

Support forwarding of completions without ever passing through the intermediary #13

Description

@sdether

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions