Пример #1
0
        public async Task <Response <T> > Accept <T>(T command) where T : ICommand
        {
            //获取leader节点
            var leader = _configProviders.GetPeer(CurrentState.LeaderId);

            if (leader != null)
            {
                _logger.LogInformation($"follower id: {CurrentState.Id} forward to leader id: {leader.Id}");
                return(await leader.Request(command));
            }
            return(new ErrorResponse <T>("Please retry command later. Unable to find leader.", command));
        }