public override FutureResponse AsyncRequest(ICommand command) { var commandId = GetNextCommandId(); command.CommandId = commandId; command.ResponseRequired = true; var future = new FutureResponse(); var priorError = _error; if (priorError == null) { _requestMap.AddOrUpdate(commandId, future, (k, v) => future); } if (priorError != null) { var brError = new BrokerError { Message = priorError.Message }; var response = new ExceptionResponse { Exception = brError }; future.Response = response; throw priorError; } Next.Oneway(command); return(future); }
public override FutureResponse AsyncRequest(ICommand command) { var commandId = GetNextCommandId(); command.CommandId = commandId; command.ResponseRequired = true; var future = new FutureResponse(); Exception priorError; lock (_requestMap.SyncRoot) { priorError = _error; if (priorError == null) { _requestMap[commandId] = future; } } if (priorError != null) { var brError = new BrokerError { Message = priorError.Message }; var response = new ExceptionResponse { Exception = brError }; future.Response = response; throw priorError; } Next.Oneway(command); return(future); }