public MessageQueueWorker(MessageQueue parent, CancellationToken cancellationToken, IMessageSerializer messageSerializer, IMessageFeedFactory msgFeedFactory) { _parent = parent; _cancellationToken = cancellationToken; _messageSerializer = messageSerializer; _messageFeedFactory = msgFeedFactory; }
public MessageQueue(IMessageSerializer messageSerializer, IMessageFeedFactory messageFeedFactory) { _outputQueue = new ConcurrentQueue <IdentifiedMessage>(); _clients = new ConcurrentDictionary <ClientId, IDataClient>(); _pipes = new ConcurrentDictionary <ClientId, Pipe>(); _cancellationTokenSource = new CancellationTokenSource(); var worker = new MessageQueueWorker(this, _cancellationTokenSource.Token, messageSerializer, messageFeedFactory); _workerThread = new Thread(worker.DoWork) { Name = "MessageQueueWorker" }; }