Ejemplo n.º 1
0
        public virtual void Execute(IJobHandlerConfiguration configuration, ExecutionEntity execution,
                                    CommandContext commandContext, string tenantId)
        {
            var         config  = (BatchSeedJobConfiguration)configuration;
            var         batchId = config.BatchId;
            BatchEntity batch   = commandContext.BatchManager.FindBatchById(batchId);

            EnsureUtil.EnsureNotNull("Batch with id '" + batchId + "' cannot be found", "batch", batch);

            IBatchJobHandler batchJobHandler =
                commandContext.ProcessEngineConfiguration.BatchHandlers[batch.Type];

            var done = batchJobHandler.CreateJobs(batch);

            if (!done)
            {
                batch.CreateSeedJob();
            }
            else
            {
                // create monitor job initially without due date to
                // enable rapid completion of simple batches
                batch.CreateMonitorJob(false);
            }
        }
Ejemplo n.º 2
0
        protected internal virtual BatchEntity CreateBatch(CommandContext commandContext, IList <AbstractProcessInstanceModificationCommand> instructions, ICollection <string> processInstanceIds, ProcessDefinitionEntity processDefinition)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration;
            IBatchJobHandler batchJobHandler = GetBatchJobHandler(processEngineConfiguration);

            ModificationBatchConfiguration configuration = new ModificationBatchConfiguration(new List <string>(processInstanceIds), builder.ProcessDefinitionId, instructions, builder.SkipCustomListeners, builder.SkipIoMappings);

            BatchEntity batch = new BatchEntity();

            batch.Type                   = batchJobHandler.Type;
            batch.TotalJobs              = CalculateSize(processEngineConfiguration, configuration);
            batch.BatchJobsPerSeed       = processEngineConfiguration.BatchJobsPerSeed;
            batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob;
            batch.ConfigurationBytes     = batchJobHandler.WriteConfiguration(configuration);
            batch.TenantId               = processDefinition.TenantId;
            commandContext.BatchManager.Add(batch);

            return(batch);
        }