예제 #1
0
        protected internal virtual BatchEntity CreateBatch(CommandContext commandContext, IList <AbstractProcessInstanceModificationCommand> instructions, IList <string> processInstanceIds, ProcessDefinitionEntity processDefinition)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration;
            IBatchJobHandler batchJobHandler = GetBatchJobHandler(processEngineConfiguration);

            RestartProcessInstancesBatchConfiguration configuration = new RestartProcessInstancesBatchConfiguration(processInstanceIds, instructions, builder.ProcessDefinitionId, builder.InitialVariables, builder.SkipCustomListeners, builder.SkipIoMappings, builder.WithoutBusinessKey);

            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);
        }
예제 #2
0
        protected internal virtual int CalculateSize(ProcessEngineConfigurationImpl engineConfiguration, RestartProcessInstancesBatchConfiguration batchConfiguration)
        {
            int invocationsPerBatchJob = engineConfiguration.InvocationsPerBatchJob;
            int processInstanceCount   = batchConfiguration.Ids.Count;

            return((int)Math.Ceiling((decimal)(processInstanceCount / invocationsPerBatchJob)));
        }