예제 #1
0
        public async Task <ActionResult <string> > GetAsync()
        {
            _logger.LogInformation("start call to user actor");
            var userService = _actorFactory.FindTopLevelActor <UserService>();
            var command     = new GetUserDetail(1);
            var result      = await userService.Ask <UserDetailResult>(command, TimeSpan.FromSeconds(30));

            //var result = await _userManagerActor.Ask<UserDetailResult>(command, TimeSpan.FromSeconds(30));
            if (result.HasError)
            {
                throw result.Exception;
            }

            _logger.LogInformation("end call to user actor");
            return(new ActionResult <string>($"{result.FirstName} {result.LastName}"));
            //return new string[] { "value1", "value2" };
        }