コード例 #1
0
        /// <summary>
        /// create bundle, process the file
        /// </summary>
        public string ProcessLocalInputfile(string filename, TempFileHandle tempFile, IDictionary <string, string> properties)
        {
            var bundleInfo = bundleRepo.Create(filename, properties);

            ScheduleProcessLocalFile(bundleInfo.BundleId, filename, tempFile);
            return(bundleInfo.BundleId);
        }
コード例 #2
0
        public void ScheduleProcessLocalFile(string bundleId, string filename, TempFileHandle tempFile, byte[] dynatraceTag = null)
        {
            var processTracer = dynatraceSdk.TraceIncomingMessageProcess(messagingSystemInfo);

            processTracer.SetDynatraceByteTag(dynatraceTag);
            processTracer.Trace(() =>
                                AsyncHelper.RunSync(() => ProcessFileAsync(bundleId, filename, tempFile))
                                );
            tempFile.Dispose();             // now it's safe to delete temp file
        }
コード例 #3
0
 public async Task DownloadAndScheduleProcessFileAsync(string bundleId, string url, string filename)
 {
     bundleRepo.SetBundleStatus(bundleId, BundleStatus.Downloading);
     try {
         using (TempFileHandle tempFile = await downloadService.Download(bundleId, url, filename)) {
             await ProcessFileAsync(bundleId, filename, tempFile);
         }
     } catch (Exception e) {
         bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString());
     }
 }
コード例 #4
0
        public void CreateTempFileHandleTest()
        {
            string?tempFileName = null;

            using (var temp = new TempFileHandle())
            {
                tempFileName = temp.FilePath;
                this.TestContext.WriteLine(temp.FilePath);
                Assert.IsTrue(File.Exists(tempFileName));
            }
            Assert.IsFalse(File.Exists(tempFileName));
        }
コード例 #5
0
        private async Task ProcessFileAsync(string bundleId, string filename, TempFileHandle tempFile)
        {
            if (settings.Value.DuplicationDetectionEnabled && !SetHashAndCheckIfDuplicated(bundleId, tempFile.File))
            {
                // duplication detected
                return;
            }

            bundleRepo.SetBundleStatus(bundleId, BundleStatus.Analyzing);
            try {
                await ProcessFile(bundleId, tempFile.File);

                bundleRepo.SetBundleStatus(bundleId, BundleStatus.Finished);
            } catch (Exception e) {
                bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString());
            }
        }
コード例 #6
0
        private async Task ProcessFileAsync(string bundleId, string filename, TempFileHandle tempFile)
        {
            if (settings.Value.DuplicationDetectionEnabled && !SetHashAndCheckIfDuplicated(bundleId, tempFile.File))
            {
                // duplication detected
                return;
            }

            bundleRepo.SetBundleStatus(bundleId, BundleStatus.Analyzing);
            try {
                await ProcessFile(bundleId, tempFile.File);

                IEnumerable <DumpMetainfo> dumps = await InitialAnalysis(bundleId, tempFile.File.Directory);

                analysisService.ScheduleDumpAnalysis(dumps);

                bundleRepo.SetBundleStatus(bundleId, BundleStatus.Finished);
            } catch (Exception e) {
                bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString());
            }
        }