Exemplo n.º 1
0
        public async Task<RemoteClusterActivationResponse[]> ProcessActivationRequestBatch(GrainId[] grains, string sendingClusterId)
        {
            var tasks = grains.Select(g => ProcessActivationRequest(g, sendingClusterId)).ToList();
            try
            {
                await Task.WhenAll(tasks);
            }
            catch (Exception)
            {
                // Exceptions will be observed and returned in the response
            }

            var responses = tasks.Select(responseTask =>
                responseTask.Exception == null
                    ? responseTask.Result
                    : new RemoteClusterActivationResponse(ActivationResponseStatus.Faulted) { ResponseException = responseTask.Exception })
                .ToArray();

            return responses;
        }