Search in sources :

Example 1 with SetRetriesBatchConfiguration

use of org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration in project camunda-bpm-platform by camunda.

the class SetExternalTaskRetriesJobHandler method execute.

@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
    ByteArrayEntity configurationEntity = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
    SetRetriesBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
    boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
    commandContext.disableUserOperationLog();
    commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
    try {
        commandContext.getProcessEngineConfiguration().getExternalTaskService().setRetries(batchConfiguration.getIds(), batchConfiguration.getRetries());
    } finally {
        commandContext.enableUserOperationLog();
        commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
    }
    commandContext.getByteArrayManager().delete(configurationEntity);
}
Also used : SetRetriesBatchConfiguration(org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration) ByteArrayEntity(org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity)

Example 2 with SetRetriesBatchConfiguration

use of org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration in project camunda-bpm-platform by camunda.

the class SetExternalTasksRetriesBatchCmd method createBatch.

protected BatchEntity createBatch(CommandContext commandContext, Collection<String> processInstanceIds) {
    ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
    BatchJobHandler<SetRetriesBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);
    SetRetriesBatchConfiguration configuration = new SetRetriesBatchConfiguration(new ArrayList<String>(processInstanceIds), builder.getRetries());
    BatchEntity batch = new BatchEntity();
    batch.setType(batchJobHandler.getType());
    batch.setTotalJobs(calculateSize(processEngineConfiguration, configuration));
    batch.setBatchJobsPerSeed(processEngineConfiguration.getBatchJobsPerSeed());
    batch.setInvocationsPerBatchJob(processEngineConfiguration.getInvocationsPerBatchJob());
    batch.setConfigurationBytes(batchJobHandler.writeConfiguration(configuration));
    commandContext.getBatchManager().insert(batch);
    return batch;
}
Also used : SetRetriesBatchConfiguration(org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 3 with SetRetriesBatchConfiguration

use of org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration in project camunda-bpm-platform by camunda.

the class SetJobRetriesJobHandler method execute.

@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
    ByteArrayEntity configurationEntity = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
    SetRetriesBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
    boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
    commandContext.disableUserOperationLog();
    commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
    try {
        commandContext.getProcessEngineConfiguration().getManagementService().setJobRetries(batchConfiguration.getIds(), batchConfiguration.getRetries());
    } finally {
        commandContext.enableUserOperationLog();
        commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
    }
    commandContext.getByteArrayManager().delete(configurationEntity);
}
Also used : SetRetriesBatchConfiguration(org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration) ByteArrayEntity(org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity)

Aggregations

SetRetriesBatchConfiguration (org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration)3 ByteArrayEntity (org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity)2 BatchEntity (org.camunda.bpm.engine.impl.batch.BatchEntity)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1