コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }