示例#1
0
        public static IStreamLogIngestor CreateDefaultStreamIngestor(IStreamIngestorConfiguration streamIngestorConfiguration,
            IContentFilterFactory contentFilterFactory)
        {
            var factory = new SqlServerStreamIngestorFactory();
            return factory.WithDefaultParser()
                .WithContentFilterFactory(new ContentFilterFactory())
                .WithPersisterDaemon(factory.BuildDefaultPersisterDaemon(streamIngestorConfiguration))
                .Build();

            //IPersistenceConfiguration persistenceConfiguration = new PersistenceConfiguration();

            //var eventPersister = new EventPersister(persistenceConfiguration,
            //    new DataExtractor(persistenceConfiguration,
            //        new FingerprintReader(persistenceConfiguration),
            //        new ServerReader(persistenceConfiguration)),
            //    new ErrorDefinitionWriter(persistenceConfiguration),
            //    new TimelineWriter(persistenceConfiguration),
            //    new ErrorMessageWriter(persistenceConfiguration));

            //return new StreamLogIngestor(new EventFilterFactory(),
            //    new DefaultCSharpErrorParser(streamIngestorConfiguration),
            //    new ContentFilterFactory(streamIngestorConfiguration),
            //    new NullEventDiscarder(),
            //    new PersisterDaemon(streamIngestorConfiguration, eventPersister, new NullEventDiscarder()));
        }
示例#2
0
        public static IStreamLogIngestor CreateStreamIngestorWithCustomParser(IStreamIngestorConfiguration streamIngestorConfiguration = null,
            IContentFilterFactory contentFilterFactory = null)
        {
            if (streamIngestorConfiguration == null)
                streamIngestorConfiguration = new StreamIngestorConfiguration();

            if (contentFilterFactory == null)
                contentFilterFactory = new ContentFilterFactory();

            var factory = new SqlServerStreamIngestorFactory();
            return factory.WithCustomParser()
                .WithContentFilterFactory(contentFilterFactory)
                .WithPersisterDaemon(factory.BuildDefaultPersisterDaemon(streamIngestorConfiguration))
                .Build();
        }
示例#3
0
 public PersisterDaemon(IStreamIngestorConfiguration configuration,
     IEventPersister eventPersister,
     IEventDiscarder eventDiscarder)
 {
     _configuration = configuration;
     _eventPersister = eventPersister;
     _eventDiscarder = eventDiscarder;
     
     _persistQueue = new ConcurrentQueue<ErrorInstanceEntity>();
     _errorDefinitions = new ConcurrentDictionary<string, ErrorDefinitionEntity>();
     _lastPersisted = DateTime.UtcNow;
     _stringCache = new Dictionary<int, string>();
     _fingerprintCache = new Dictionary<int, Fingerprint>();
     _serverCache = new Dictionary<int, string>();
 }
 public IStreamIngestorFactoryDescriptor WithDefaultPersisterDaemon(IStreamIngestorConfiguration configuration)
 {
     _persisterDaemon = BuildDefaultPersisterDaemon(configuration);
     return this;
 }
        public IPersisterDaemon BuildDefaultPersisterDaemon(IStreamIngestorConfiguration streamIngestorConfiguration = null, 
            IPersistenceConfiguration persistenceConfiguration = null)
        {
            if(streamIngestorConfiguration == null)
                streamIngestorConfiguration = new StreamIngestorConfiguration();

            if(persistenceConfiguration == null)
                persistenceConfiguration = new PersistenceConfiguration();

            var eventPersister = new EventPersister(persistenceConfiguration,
                new DataExtractor(persistenceConfiguration,
                    new FingerprintReader(persistenceConfiguration),
                    new ServerReader(persistenceConfiguration),
                    new ServerWriter(persistenceConfiguration)),
                new ErrorDefinitionWriter(persistenceConfiguration),
                new TimelineWriter(persistenceConfiguration));

            if (_eventDiscarder == null)
                _eventDiscarder = new NullEventDiscarder();

            return new PersisterDaemon(streamIngestorConfiguration, eventPersister, _eventDiscarder);
        }