//Here we will process the rejected messages and see if that's ok or not protected void ProcessReject(object param) { try { lock (TimeoutOrders) { Wrapper rejectWrapper = (Wrapper)param; string key = (string)rejectWrapper.GetField(RejectFields.KEY); string text = (string)rejectWrapper.GetField(RejectFields.Text); if (TimeoutOrders.ContainsKey(key)) { TimeoutOrders.Remove(key); } if (MessageOk.ContainsKey(key)) { string refTag = (string)rejectWrapper.GetField(RejectFields.RefTagID); //We expected the message to be ok but it was ejected DoLog(string.Format("<{0}>-Test case FAILED for Order ClOrdId = {1}. We expected the order to be ok but it was rejected. Reason={2} Tag={3}", Configuration.Name, key, text, refTag != null ? refTag : "??"), Constants.MessageType.AssertFailed); } if (MissingTags.ContainsKey(key)) { string refTag = (string)rejectWrapper.GetField(RejectFields.RefTagID); if (MissingTags[key] == refTag) { DoLog(string.Format("<{0}>-Test case OK for ClOrdId ={1}. Expected to have a message rejected for missing tag ={2} and it was rejected for that tag", Configuration.Name, key, refTag), Constants.MessageType.AssertOk); } else { DoLog(string.Format("<{0}>-Test case FAILED for ClOrdId ={1}. Expected to have a message rejected for missing tag ={2} but it was rejected for tag {3}", Configuration.Name, key, MissingTags[key], refTag), Constants.MessageType.AssertFailed); } } if (ExtraTags.ContainsKey(key)) { //Validar que el error es por Extra Tags } } } catch (Exception ex) { DoLog(string.Format("{0}-Critical error processing a reject:{1}", Configuration.Name, ex.Message), Constants.MessageType.Error); } }
protected void ProcessExecutionReport(object param) { try { lock (TimeoutOrders) { Wrapper erWrapper = (Wrapper)param; string key = (string)erWrapper.GetField(ExecutionReportFields.KEY); if (TimeoutOrders.ContainsKey(key)) { TimeoutOrders.Remove(key); } if (MessageOk.ContainsKey(key)) { //We expected the message to be ok but it was ejected DoLog(string.Format("<{0}>-Test case OK for Order ClOrdId = {1}. We expected a valid ER and that was received.", Configuration.Name, key), Constants.MessageType.AssertOk); } if (MissingTags.ContainsKey(key)) { DoLog(string.Format("<{0}>-Test case FAILED for ClOrdId ={1}. Expected a missing tag {2} but received an Ok Execution Report", Configuration.Name, key, MissingTags[key]), Constants.MessageType.AssertFailed); } if (ExtraTags.ContainsKey(key)) { DoLog(string.Format("<{0}>-Test case FAILED for ClOrdId ={1}. Expected an extra tag {2} but received an Ok Execution Report", Configuration.Name, key, ExtraTags[key]), Constants.MessageType.AssertFailed); } } } catch (Exception ex) { DoLog(string.Format("{0}-Critical error processing a execution report:{1}", Configuration.Name, ex.Message), Constants.MessageType.Error); } }
protected void ProcessExecutionReport(object param) { try { lock (TimeoutOrders) { Wrapper erWrapper = (Wrapper)param; string key = (string)erWrapper.GetField(ExecutionReportFields.KEY); string orderId = (string)erWrapper.GetField(ExecutionReportFields.OrderID); string clOrderId = (string)erWrapper.GetField(ExecutionReportFields.ClOrdID); if (MessageOk.ContainsKey(key)) { ExecutionReportsReceived[key]++; if (ExecutionReportsReceived[key] == Configuration.ResponsesToArrive) { TimeoutOrders.Remove(key); DoLog(string.Format("<{0}>- Received {1} ERs with order id {2}", Configuration.Name, ExecutionReportsReceived[key], orderId), Constants.MessageType.AssertOk); } else if (ExecutionReportsReceived[key] > Configuration.ResponsesToArrive) { DoLog(string.Format("<{0}>- Received {1} ERs for ClOrdId {2}. This is more than expected (max {3})!!!!", Configuration.Name, ExecutionReportsReceived[key], clOrderId, Configuration.ResponsesToArrive), Constants.MessageType.AssertFailed); } } //This must be an order we don't manage or that we have already rejected so the counter is considered to be not working } } catch (Exception ex) { DoLog(string.Format("<{0}>-Critical error processing a execution report:{1}", Configuration.Name, ex.Message), Constants.MessageType.AssertFailed); } }