private void Route(Message message) { // Route To WCF Client or FIX Client try { // if you can extract the OrdID (Tag 11) if (message.isSetField(11)) { bool isWcf = true; string[] msgArr = message.getField(11).Split(new string[] { _msgSplit }, StringSplitOptions.None); string prefix = msgArr[0]; if (prefix == _fixPrefixCode) { isWcf = false; } //else(prefix == _wcfPrefixCode) message.removeField(11); if (!isWcf) { // Ex: F-A-101 string sessionCode = msgArr[1]; string ordID = msgArr[2]; message.setField(11, ordID); RouteDirectFixClient(sessionCode, ordID, message); } else { // Ex: F-101 string ordID = msgArr[1]; message.setField(11, ordID); SvcFixServer.Replicate(message); RouteToWcfClient(ordID, message); } } else // if not then send to next processor { _router.PushMessage(message); } } catch (Exception ex) { //_router.PushMessage(message); SystemLogger.WriteOnConsoleAsync(true, string.Format("error while routing response OrdIDID [{0}] : {1}", message.isSetField(11) ? message.getField(11) : "Not Found In Fix Msg", ex.Message), ConsoleColor.Red, ConsoleColor.Black, true); } }
private void RouteDirectFixClient(string sessionCode, string ordID, Message message) { SystemLogger.WriteOnConsoleAsync(true, string.Format("Response to FIX Client OrderID [{0}]", ordID), ConsoleColor.Blue, ConsoleColor.White, false); SvcFixServer.RouteFixMessageToClient(sessionCode, ordID, message); }