Пример #1
0
 private async Task Process(FileStoreMessage message)
 {
     //Console.WriteLine($"Indexing ");
     //using (var stream = new MemoryStream(message.FileContent))
     //{
     //    var client = new HttpClient();
     //    var indexDocUri = new Uri(BaseUri, $"update/extract?literal.id={message.FileMetadata.Key}&commit={true}");
     //    var streamContent = new StreamContent(stream);
     //    var docIndexingResponse = await client.PostAsync(indexDocUri, streamContent);
     //}
 }
Пример #2
0
        private async Task Process(FileStoreMessage message)
        {
            var elkUrl     = new Uri("http://localhost:9200/");
            var connection = new ConnectionSettings(elkUrl);
            var bucket     = new GridFSBucket(connection);

            var fileName = message.Filepath.Split('\\').Last();

            Console.WriteLine($"Uploading the file {fileName}.");
            var timer = new Stopwatch();

            timer.Start();

            using (var fileStream = File.OpenRead(message.Filepath))
            {
                await bucket.UploadFromStreamAsync(Guid.NewGuid(), fileName, fileStream);
            }
            timer.Stop();
            Console.WriteLine($"Upload of file {fileName} has finished. Elaspsed time: {timer.ElapsedMilliseconds} ms.");
        }
Пример #3
0
 private void Process(FileStoreMessage message)
 {
     IndexFileActor.Tell(message);
     StoreFileActor.Tell(message);
 }