IEngineProcess BuildConsumingProcess(IComponentContext context)
        {
            var log      = context.Resolve <ISystemObserver>();
            var streamer = context.Resolve <IEnvelopeStreamer>();

            var dispatcher = _dispatcher(context);

            dispatcher.Init();


            var queues = _fileQueues
                         .Select(n => Path.Combine(_fullPath.Folder.FullName, n))
                         .Select(n => new DirectoryInfo(n))
                         .Select(f => new StatelessFileQueueReader(streamer, log, new Lazy <DirectoryInfo>(() =>
            {
                var poison = Path.Combine(f.FullName, "poison");
                var di     = new DirectoryInfo(poison);
                di.Create();
                return(di);
            }, LazyThreadSafetyMode.ExecutionAndPublication), f, f.Name))
                         .ToArray();
            var inbox      = new FilePartitionInbox(queues, _decayPolicy);
            var quarantine = _quarantineFactory(context);
            var manager    = context.Resolve <MessageDuplicationManager>();
            var transport  = new DispatcherProcess(log, dispatcher, inbox, quarantine, manager);


            return(transport);
        }
        IEngineProcess BuildConsumingProcess(IComponentContext context)
        {
            var log = context.Resolve<ISystemObserver>();
            var streamer = context.Resolve<IEnvelopeStreamer>();

            var dispatcher = _dispatcher(context);
            dispatcher.Init();

            var queues = _fileQueues
                .Select(n => Path.Combine(_fullPath.Folder.FullName, n))
                .Select(n => new DirectoryInfo(n))
                .Select(f => new StatelessFileQueueReader(streamer, log, new Lazy<DirectoryInfo>(() =>
                    {
                        var poison = Path.Combine(f.FullName, "poison");
                        var di = new DirectoryInfo(poison);
                        di.Create();
                        return di;
                    }, LazyThreadSafetyMode.ExecutionAndPublication), f, f.Name))
                .ToArray();
            var inbox = new FilePartitionInbox(queues, _decayPolicy);
            var quarantine = _quarantineFactory(context);
            var manager = context.Resolve<MessageDuplicationManager>();
            var transport = new DispatcherProcess(log, dispatcher, inbox, quarantine, manager);

            return transport;
        }