void IMessageProcessor.Clear(ClearMessageQueueMessage message) { if (message == null) { throw new ArgumentNullException("message"); } DefaultProcessor.Clear(message); }
void IMessageProcessor.Clear(ClearMessageQueueMessage message) { _messageProcessor.Clear(message); }
/// <summary> /// Метод обработки исходящих сообщений для <see cref="OutMessageProcessor"/>. /// </summary> /// <param name="message">Сообщение.</param> /// <param name="adapter">Адаптер.</param> protected virtual void OnOutMessageProcessor(Message message, IMessageAdapter adapter) { if (this != adapter) { return; } switch (message.Type) { case MessageTypes.ClearMessageQueue: OutMessageProcessor.Clear((ClearMessageQueueMessage)message); return; case MessageTypes.Security: { NewOutMessage.SafeInvoke(message); if (!SessionHolder.CreateAssociatedSecurity) { break; } var clone = (SecurityMessage)message.Clone(); clone.SecurityId = CloneSecurityId(clone.SecurityId); NewOutMessage.SafeInvoke(clone); break; } case MessageTypes.Level1Change: { NewOutMessage.SafeInvoke(message); var l1Msg = (Level1ChangeMessage)message; if (l1Msg.SecurityId.IsDefault()) { break; } if (SessionHolder.CreateAssociatedSecurity) { // обновление BestXXX для ALL из конкретных тикеров var clone = (Level1ChangeMessage)l1Msg.Clone(); clone.SecurityId = CloneSecurityId(clone.SecurityId); NewOutMessage.SafeInvoke(clone); } if (SessionHolder.CreateDepthFromLevel1) { // генерация стакана из Level1 var builder = _level1DepthBuilders.SafeAdd(l1Msg.SecurityId, c => new Level1DepthBuilder(c)); if (builder.Process(l1Msg)) { var quoteMsg = builder.QuoteChange; NewOutMessage.SafeInvoke(quoteMsg); CreateAssociatedSecurityQuotes(quoteMsg); } } break; } case MessageTypes.QuoteChange: { var quoteMsg = (QuoteChangeMessage)message; NewOutMessage.SafeInvoke(quoteMsg); if (SessionHolder.CreateDepthFromLevel1) { _level1DepthBuilders.SafeAdd(quoteMsg.SecurityId, c => new Level1DepthBuilder(c)).HasDepth = true; } CreateAssociatedSecurityQuotes(quoteMsg); break; } case MessageTypes.Execution: { NewOutMessage.SafeInvoke(message); if (!SessionHolder.CreateAssociatedSecurity) { break; } var execMsg = (ExecutionMessage)message; if (execMsg.SecurityId.IsDefault()) { break; } switch (execMsg.ExecutionType) { case ExecutionTypes.Tick: case ExecutionTypes.OrderLog: { var clone = (ExecutionMessage)message.Clone(); clone.SecurityId = CloneSecurityId(clone.SecurityId); NewOutMessage.SafeInvoke(clone); break; } } break; } default: NewOutMessage.SafeInvoke(message); break; } }