/// <summary>
 /// Creates a new instance of the single-thread token processor with
 /// given shared collection of tokens.
 /// </summary>
 /// <param name="tokensToProcess">shared collection of tokens to be
 /// processed</param>
 /// <param name="processor">reference to a processor component
 /// </param>
 public SingleThreadProcessor(
     BlockingCollection<Token> tokensToProcess,
     ProcessorService processor,
     MessageFlow messageFlow)
 {
     this.tokensToProcess = tokensToProcess;
     this.Processor = processor;
     this.messageFlow = messageFlow;
 }
Example #2
0
 private void CreateMessageFlowInstances(int concurrentThreadsCount)
 {
     // NOTE: each SingleThreadProcessor must have its own message flow instance
     // since they might not be thread-safe
     var config = Configuration.GetMessageFlow();
     messageFlows = new MessageFlow[concurrentThreadsCount];
     for (int i = 0; i < concurrentThreadsCount; i++)
     {
         messageFlows[i] = new MessageFlow(config, this);
     }
 }