public TradeResponse Handle(TradeRequest tradeRequest) { TradeResponse tradeResponse; ArrayList errors = new ArrayList(); if (creditCheckService.CanExecute(tradeRequest, errors)) { tradeResponse = executionVenueService.ExecuteTradeRequest(tradeRequest); } else { tradeResponse = new TradeResponse(); tradeResponse.Error = true; tradeResponse.ErrorMessage = StringUtils.ArrayToCommaDelimitedString(errors.ToArray()); } tradingService.ProcessTrade(tradeRequest, tradeResponse); return(tradeResponse); }
public TradeResponse Handle(TradeRequest tradeRequest) { log.Info("received trade request - sleeping 2s to simulate long-running task"); TradeResponse tradeResponse; ArrayList errors = new ArrayList(); if (creditCheckService.CanExecute(tradeRequest, errors)) { tradeResponse = executionVenueService.ExecuteTradeRequest(tradeRequest); } else { tradeResponse = new TradeResponse(); tradeResponse.Error = true; tradeResponse.ErrorMessage = StringUtils.ArrayToCommaDelimitedString(errors.ToArray()); } tradingService.ProcessTrade(tradeRequest, tradeResponse); Thread.Sleep(2000); return(tradeResponse); }