private Task PublishExceptionAsync(ProcessingCommand processingCommand, IDomainException exception, int retryTimes, TaskCompletionSource <bool> taskSource)
        {
            exception.MergeItems(processingCommand.Message.Items);

            _ioHelper.TryAsyncActionRecursivelyWithoutResult("PublishExceptionAsync",
                                                             () => _exceptionPublisher.PublishAsync(exception),
                                                             currentRetryTimes => PublishExceptionAsync(processingCommand, exception, currentRetryTimes, taskSource),
                                                             async() =>
            {
                await CompleteCommand(processingCommand, CommandStatus.Failed, exception.GetType().Name, (exception as Exception).Message).ConfigureAwait(false);
                taskSource.SetResult(true);
            },
                                                             () =>
            {
                var serializableInfo = new Dictionary <string, string>();
                exception.SerializeTo(serializableInfo);
                var exceptionInfo = string.Join(",", serializableInfo.Select(x => string.Format("{0}:{1}", x.Key, x.Value)));
                return(string.Format("[commandId:{0}, exceptionInfo:{1}]", processingCommand.Message.Id, exceptionInfo));
            },
                                                             null,
                                                             retryTimes, true);

            return(taskSource.Task);
        }
示例#2
0
 public Task PublishAsync(IDomainException exception)
 {
     return(Task.CompletedTask);
 }
示例#3
0
 public Task <AsyncTaskResult> PublishAsync(IDomainException exception)
 {
     return(_successResultTask);
 }