示例#1
0
 public MessageQueueWorker(MessageQueue parent, CancellationToken cancellationToken, IMessageSerializer messageSerializer, IMessageFeedFactory msgFeedFactory)
 {
     _parent             = parent;
     _cancellationToken  = cancellationToken;
     _messageSerializer  = messageSerializer;
     _messageFeedFactory = msgFeedFactory;
 }
示例#2
0
        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"
            };
        }