Beispiel #1
0
        public static ILogsProcessorBuilder UseAzureTableStorageForBlockProgress(
            this ILogsProcessorBuilder processor, CloudTableSetup cloudTableSetup)
        {
            processor.BlockProgressRepository = cloudTableSetup.CreateBlockProgressRepository();

            return(processor);
        }
Beispiel #2
0
        public static ILogsProcessorBuilder StoreInAzureTable(this ILogsProcessorBuilder eventLogProcessor, CloudTableSetup cloudTableSetup, Predicate <FilterLog> predicate = null)
        {
            var transactionLogRepository = cloudTableSetup.CreateTransactionLogRepository();
            var processor = new TransactionLogProcessor(transactionLogRepository, predicate);

            eventLogProcessor.Add(processor);
            return(eventLogProcessor);
        }
Beispiel #3
0
        public static ILogsProcessorBuilder StoreInAzureTable <TEventDto>(this ILogsProcessorBuilder processorBuilder, CloudTableSetup cloudTableSetup, Predicate <EventLog <TEventDto> > predicate = null)
            where TEventDto : class, new()
        {
            var transactionLogRepository = cloudTableSetup.CreateTransactionLogRepository();
            var processor = new TransactionLogProcessor <TEventDto>(transactionLogRepository, predicate);

            processorBuilder.Add(processor);
            return(processorBuilder);
        }
Beispiel #4
0
        private static AzureSearchService CreateAzureSearchServiceAndMarkForDisposal(this ILogsProcessorBuilder processorBuilder,
                                                                                     string searchServiceName,
                                                                                     string apiKey)
        {
            var searchService = new AzureSearchService(searchServiceName, apiKey);

            processorBuilder.DisposeOnProcessorDisposing(searchService);
            return(searchService);
        }
 public static async Task<ILogsProcessorBuilder> AddToQueueAsync(
     this ILogsProcessorBuilder eventLogProcessor,
     string azureConnectionString,
     string queueName,
     Predicate<FilterLog> predicate = null,
     Func<FilterLog, object> mapper = null)
 {
     var factory = new AzureSubscriberQueueFactory(azureConnectionString);
     return await eventLogProcessor.AddToQueueAsync(factory, queueName, predicate, mapper);
 }
Beispiel #6
0
        public static ILogsProcessorBuilder AddToSearchIndex <TEventDto>(
            this ILogsProcessorBuilder processorBuilder,
            IEventIndexer <TEventDto> indexer,
            Predicate <EventLog <TEventDto> > predicate = null) where TEventDto : class, new()
        {
            var processor = new EventIndexProcessor <TEventDto>(indexer, predicate: predicate);

            processorBuilder.Add(processor);
            return(processorBuilder);
        }
Beispiel #7
0
        public static async Task <ILogsProcessorBuilder> AddToSearchIndexAsync <TEventDto>(
            this ILogsProcessorBuilder processorBuilder,
            string searchServiceName,
            string apiKey,
            string indexName,
            Predicate <EventLog <TEventDto> > predicate = null) where TEventDto : class, new()
        {
            var searchService = processorBuilder.CreateAzureSearchServiceAndMarkForDisposal(searchServiceName, apiKey);

            return(await processorBuilder.AddToSearchIndexAsync(searchService, indexName : indexName, predicate : predicate).ConfigureAwait(false));
        }
Beispiel #8
0
        public static async Task <ILogsProcessorBuilder> AddToSearchIndexAsync <TEventDto>(
            this ILogsProcessorBuilder processorBuilder,
            IAzureSearchService azureSearchService,
            string indexName,
            Predicate <EventLog <TEventDto> > predicate = null) where TEventDto : class, new()
        {
            var indexer = await azureSearchService.CreateEventIndexer <TEventDto>(indexName).ConfigureAwait(false);

            processorBuilder.DisposeOnProcessorDisposing(indexer);
            return(processorBuilder.AddToSearchIndex(indexer, predicate: predicate));
        }
 public static async Task<ILogsProcessorBuilder> AddToQueueAsync(
     this ILogsProcessorBuilder eventLogProcessor,
     AzureSubscriberQueueFactory queueFactory,
     string queueName,
     Predicate<FilterLog> predicate = null,
     Func<FilterLog, object> mapper = null)
 {
     var queue = await queueFactory.GetOrCreateQueueAsync(queueName);
     eventLogProcessor.AddToQueue(queue, predicate, mapper);
     return eventLogProcessor;
 }
 public static async Task<ILogsProcessorBuilder> AddToQueueAsync<TEventDto>(
     this ILogsProcessorBuilder eventLogProcessor,
     string azureConnectionString,
     string queueName,
     Predicate<EventLog<TEventDto>> predicate = null,
     Func<EventLog<TEventDto>, object> mapper = null)
     where TEventDto : class, new()
 {
     var factory = new AzureSubscriberQueueFactory(azureConnectionString);
     return await eventLogProcessor.AddToQueueAsync(factory, queueName, predicate, mapper);
 }
Beispiel #11
0
        public static async Task <ILogsProcessorBuilder> AddToSearchIndexAsync <TEventDto, TSearchDocument>(
            this ILogsProcessorBuilder processorBuilder,
            string searchServiceName,
            string apiKey,
            Index azureIndex,
            Func <EventLog <TEventDto>, TSearchDocument> mappingFunc,
            Predicate <EventLog <TEventDto> > predicate = null) where TEventDto : class, new() where TSearchDocument : class, new()
        {
            var searchService = processorBuilder.CreateAzureSearchServiceAndMarkForDisposal(searchServiceName, apiKey);

            return(await processorBuilder.AddToSearchIndexAsync(searchService, azureIndex, mappingFunc, predicate).ConfigureAwait(false));
        }
Beispiel #12
0
        public static async Task <ILogsProcessorBuilder> AddToSearchIndexAsync <TEventDto, TSearchDocument>(
            this ILogsProcessorBuilder processorBuilder,
            IAzureSearchService azureSearchService,
            Index azureIndex,
            Func <EventLog <TEventDto>, TSearchDocument> mappingFunc,
            Predicate <EventLog <TEventDto> > predicate = null) where TEventDto : class, new() where TSearchDocument : class, new()
        {
            var indexer = await azureSearchService.CreateEventIndexer(azureIndex, mappingFunc).ConfigureAwait(false);

            processorBuilder.DisposeOnProcessorDisposing(indexer);
            return(processorBuilder.AddToSearchIndex(indexer, predicate));
        }
 public static async Task<ILogsProcessorBuilder> AddToQueueAsync<TEventDto>(
     this ILogsProcessorBuilder eventLogProcessor,
     AzureSubscriberQueueFactory queueFactory,
     string queueName,
     Predicate<EventLog<TEventDto>> predicate = null,
     Func<EventLog<TEventDto>, object> mapper = null)
     where TEventDto : class, new()
 {
     var queue = await queueFactory.GetOrCreateQueueAsync(queueName);
     eventLogProcessor.AddToQueue(queue, predicate, mapper);
     return eventLogProcessor;
 }
        public WritingTransfersToTheAzureStorage(string azureConnectionString, string tablePrefix, uint numberOfBlocksToProcess, TimeSpan maxDuration, uint maxBlocksPerBatch)
        {
            cancellationTokenSource = new CancellationTokenSource(maxDuration);
            _builder = new LogsProcessorBuilder("https://rinkeby.infura.io/v3/7238211010344719ad14a89db874158c")
                       .Filter <TransferEventDto>()
                       .StoreInAzureTable(azureConnectionString, tablePrefix, (Predicate <EventLog <TransferEventDto> >)((tfr) => TransferCallback(tfr)))
                       .OnBatchProcessed((args) => Output(args.LastRangeProcessed))
                       .SetBlocksPerBatch(maxBlocksPerBatch)
                       .SetLog(_log.ToILog());

            ethApiContractService = _builder.Eth;

            NumberOfBlocksToProcess = numberOfBlocksToProcess;
        }
Beispiel #15
0
        public WritingTransfersToTheConsole(string url, ILog log, uint numberOfBlocksToProcess, TimeSpan maxDuration, uint maxBlocksPerBatch)
        {
            cancellationTokenSource = new CancellationTokenSource(maxDuration);
            _builder = new LogsProcessorBuilder <TransferEventDto>(url)
                       .OnEvents((events) => Output(events))
                       .OnBatchProcessed((args) =>
            {
                HandleBatchProcessed(args.LastRangeProcessed);
            })
                       .SetBlocksPerBatch(maxBlocksPerBatch)
                       .SetLog(log);

            ethApiContractService = _builder.Eth;
            Log = log;
            NumberOfBlocksToProcess = numberOfBlocksToProcess;
        }
Beispiel #16
0
 public static ILogsProcessorBuilder UseAzureTableStorageForBlockProgress(
     this ILogsProcessorBuilder processorBuilder, string azureConnectionString, string tableNamePrefix)
 {
     return(processorBuilder.UseAzureTableStorageForBlockProgress(new CloudTableSetup(azureConnectionString, tableNamePrefix)));
 }
Beispiel #17
0
 public static ILogsProcessorBuilder StoreInAzureTable(this ILogsProcessorBuilder processorBuilder, string azureConnectionString, string tablePrefix, Predicate <FilterLog> predicate = null)
 => StoreInAzureTable(processorBuilder, new CloudTableSetup(azureConnectionString, tablePrefix), predicate);
Beispiel #18
0
 public static ILogsProcessorBuilder StoreInAzureTable <TEventDto>(this ILogsProcessorBuilder processorBuilder, string azureConnectionString, string tablePrefix, Predicate <EventLog <TEventDto> > predicate = null)
     where TEventDto : class, new() => StoreInAzureTable <TEventDto>(processorBuilder, new CloudTableSetup(azureConnectionString, tablePrefix), predicate);