public void SendMessage(FIXTMessage1_1 fixMessage) { FixFactory.AddHistory(fixMessage); if (isConnectionLost) { RemoveTickSync(fixMessage); return; } var simulator = simulators[SimulatorType.SendDisconnect]; if (simulator.CheckSequence(fixMessage.Sequence)) { if (debug) { log.Debug("Ignoring message: " + fixMessage); } ProviderSimulator.SwitchBrokerState("disconnect", false); isConnectionLost = true; return; } if (simulateSendFailed && IsRecovered && random.Next(50) == 4) { if (debug) { log.Debug("Skipping send of sequence # " + fixMessage.Sequence + " to simulate lost message. " + fixMessage); } if (fixMessage.Type == "1") { isHeartbeatPending = TimeStamp.MaxValue; } if (debug) { log.Debug("Message type is: " + fixMessage.Type); } return; } var writePacket = fixSocket.MessageFactory.Create(); var message = fixMessage.ToString(); writePacket.DataOut.Write(message.ToCharArray()); writePacket.SendUtcTime = TimeStamp.UtcNow.Internal; if (debug) { log.Debug("Simulating FIX Message: " + fixMessage); } try { fixPacketQueue.Enqueue(writePacket, writePacket.SendUtcTime); } catch (QueueException ex) { if (ex.EntryType == EventType.Terminate) { log.Warn("fix packet queue returned queue exception " + ex.EntryType + ". Dropping message due to dispose."); Dispose(); } else { throw; } } simulator = simulators[SimulatorType.SendServerOffline]; if (IsRecovered && FixFactory != null && simulator.CheckSequence(fixMessage.Sequence)) { if (debug) { log.Debug("Skipping message: " + fixMessage); } ProviderSimulator.SwitchBrokerState("offline", false); ProviderSimulator.SetOrderServerOffline(); if (requestSessionStatus) { SendSessionStatus("3"); } else { log.Info("RequestSessionStatus is false so not sending order server offline message."); } } }