public WorkerTest(IMessageVisitorFactory msgVisitorFactory, IWaitStrategy wait, Func <TIn, TOut> funWork, Queue <IMessage> readQueue, Action <IMessage> push) { _queue = readQueue; _funWork = funWork; _push = push; _wait = wait; _msgVisitor = msgVisitorFactory.Create(this); OnEndOfStream += OnEndOfStreamHandler; }
public Worker(IMessageVisitorFactory msgVisitorFactory, Func <TIn, TOut> funWork, Func <ISharedPipe <IMessage> > pipeFactory, bool shouldStopOnError) { _funWork = funWork; _msgVisitor = msgVisitorFactory.Create(this); OnEndOfStream += OnEndOfStreamHandler; (_toReader, _writer) = pipeFactory().GetReaderWriterCouple(); // Dispose handler _unsubscriber = new Unsubscriber(); // unsubscribe the event on dispose _unsubscriber.RegisterSubscription(() => OnEndOfStream -= OnEndOfStreamHandler); }