protected override System.Threading.Tasks.Task OnInitializeAsync(Event initialEvent) { if (initialEvent is RequestEvent <TRequest, TResult> req) { this.Request = req; ProcessRequest(req.Request); } return(base.OnInitializeAsync(initialEvent)); }
public static async Task Execute(IActorRuntime runtime) { int CurrentCount = 0; int incrementAmount = 3; var request = new RequestEvent <int, int>(incrementAmount); var AddActor = runtime.CreateActor(typeof(AddActor), request); var response = await request.Completed.Task; CurrentCount = CurrentCount + response; runtime.SendEvent(AddActor, HaltEvent.Instance); }