示例#1
0
        public override bool Init(ICollectFilterOptions options)
        {
            _options = options.ConvertTo <FileInputFilterOptions>();

            _watcher  = new DFileSystemWatcher(_loggerFactory.CreateLogger <DFileSystemWatcher>(), _options);
            _analyser = new FileAnalyser(_loggerFactory.CreateLogger <FileAnalyser>(), _options);

            _watcher.SetFileChangeAction((file) =>
            {
                _analyser.Analyse(file);
            });

            _analyser.SetDealContextAction((collectContext) =>
            {
                if (!OutputContext(collectContext))
                {
                    this.Pause();
                }
            });

            return(true);
        }
        public override bool Init(ICollectFilterOptions options)
        {
            _options = options.ConvertTo <ElasticsearchOutputFilterOptions>();

            return(true);
        }