void IMessageProcessor.Clear(ClearMessageQueueMessage message) { if (message == null) { throw new ArgumentNullException("message"); } DefaultProcessor.Clear(message); }
public void Clear(ClearMessageQueueMessage message) { lock (SyncRoot) { IEnumerable <Pair> messages; switch (message.MessageTypes) { case MessageTypes.Execution: messages = InnerCollection .Where(m => { if (m.Value.Item1.Type != MessageTypes.Execution) { return(false); } var execMsg = (ExecutionMessage)m.Value.Item1; return(execMsg.SecurityId == message.SecurityId && (message.Arg == null || message.Arg.Compare(execMsg.ExecutionType) == 0)); }); break; case MessageTypes.QuoteChange: messages = InnerCollection.Where(m => m.Value.Item1.Type == MessageTypes.QuoteChange && ((QuoteChangeMessage)m.Value.Item1).SecurityId == message.SecurityId); break; case MessageTypes.Level1Change: messages = InnerCollection.Where(m => m.Value.Item1.Type == MessageTypes.Level1Change && ((Level1ChangeMessage)m.Value.Item1).SecurityId == message.SecurityId); break; default: return; } InnerCollection.RemoveRange(messages); } }
void IMessageProcessor.Clear(ClearMessageQueueMessage message) { _messageQueue.Clear(message); }