Пример #1
0
        public override void Execute()
        {
            //retrieve ResourceServerId for agent for checking resource pool. this value will be used when retrieving records from queue
            ResourceServerId = SqlQueryHelper.GetResourceServerByAgentId(EddsDbContext, AgentId);
            if (ResourceServerId == 0)
            {
                TextExtractorLog.RaiseUpdate(string.Format("Resource Server for Agent ID {0} cannot be detected.", AgentId));
                return;
            }

            TextExtractorLog.RaiseUpdate("Processing Worker Queue Batch.");
            var workerQueue = new WorkerQueue(SqlQueryHelper, ArtifactQueries, ArtifactFactory, EddsDbContext, ServicesMgr, ExecutionIdentity, AgentId, ResourceServerId, BatchTableName, TextExtractorLog, TextExtractorJobReporting);

            if (workerQueue.HasRecords)
            {
                WorkspaceArtifactId = workerQueue.WorkspaceArtifactId;
                var extractorSet = ArtifactFactory.GetInstanceOfExtractorSet(ExecutionIdentity.CurrentUser, workerQueue.WorkspaceArtifactId, workerQueue.ExtractorSetArtifactId);

                //check for ExtractorSet cancellation
                Boolean isCancelled = CheckForExtractorSetCancellation(extractorSet, true);
                if (!isCancelled)
                {
                    //process worker queue records in current batch
                    workerQueue.ProcessAllRecords();

                    //check for ExtractorSet cancellation
                    CheckForExtractorSetCancellation(extractorSet, false);
                }
            }

            TextExtractorLog.RaiseUpdate("Worker Queue Batch processed.");
        }
Пример #2
0
        public void ProcessAllRecordsTest()
        {
            IntegrationSettings    testSettings        = new IntegrationSettings();
            IntegrationDBContext   testDBContext       = new IntegrationDBContext(testSettings.DBContextSettings);
            IntegrationServicesMgr testServiceManager  = new IntegrationServicesMgr(testSettings.RsapiSettings);
            SqlQueryHelper         testSqlQueryHelpers = new SqlQueryHelper();
            ArtifactQueries        artifactQueries     = new ArtifactQueries();
            ArtifactFactory        artifactFactory     = new ArtifactFactory(artifactQueries, testServiceManager, null);

            Int32                 agentId               = 1016595;
            Int32                 resourceServerId      = 1016158;
            string                batchTableName        = "[" + Constant.Names.TablePrefix + "Worker_" + Guid.NewGuid() + "_" + agentId + "]";
            TextExtractorLog      textExtractorLog      = new TextExtractorLog();
            ExtractorSetReporting extractorSetReporting = new ExtractorSetReporting(artifactQueries, testServiceManager);

            WorkerQueue workerQueue = new WorkerQueue(testSqlQueryHelpers, artifactQueries, artifactFactory, testDBContext, testServiceManager, ExecutionIdentity.System,
                                                      agentId, resourceServerId, batchTableName, textExtractorLog, extractorSetReporting);

            workerQueue.ProcessAllRecords();
        }