public async Task StartHere() { ElasticClient elasticClient = CreateElasticClient(); using (var processor = new ElasticEventIndexingProcessor(elasticClient, BlockchainUrl)) { await ClearDown(processor); try { // subscribe to transfer events var transferEventProcessor = await processor.AddAsync <TransferEvent_ERC20>(TransferIndexName); var blocksProcessed = await processor.ProcessAsync(3146684, 3146694); Assert.Equal((ulong)11, blocksProcessed); Assert.Equal(19, transferEventProcessor.Indexer.Indexed); await Task.Delay(TimeSpan.FromSeconds(5)); // allow time for indexing Assert.Equal(19, await transferEventProcessor.Indexer.DocumentCountAsync()); } finally { await ClearDown(processor); } } }
public async Task StoringCustomSearchDocuments_UsingMapper() { ElasticClient elasticClient = CreateElasticClient(); using (var processor = new ElasticEventIndexingProcessor(elasticClient, BlockchainUrl)) { await ClearDown(processor); try { var mapper = new CustomEventToSearchDocumentMapper(); // subscribe to transfer events // inject a mapper to translate the event DTO to a search document DTO var transferEventProcessor = await processor .AddAsync <TransferEvent_ERC20, CustomTransferSearchDocumentDto>( TransferIndexName, mapper); var blocksProcessed = await processor.ProcessAsync(3146684, 3146694); Assert.Equal((ulong)11, blocksProcessed); Assert.Equal(19, transferEventProcessor.Indexer.Indexed); } finally { await ClearDown(processor); } } }