use of org.camunda.bpm.engine.impl.jobexecutor.TimerEventJobHandler.TimerJobConfiguration in project camunda-bpm-platform by camunda.
the class TimerEventJobHandler method newConfiguration.
@Override
public TimerJobConfiguration newConfiguration(String canonicalString) {
String[] configParts = canonicalString.split("\\" + JOB_HANDLER_CONFIG_PROPERTY_DELIMITER);
if (configParts.length > 2) {
throw new ProcessEngineException("Illegal timer job handler configuration: '" + canonicalString + "': exprecting a one or two part configuration seperated by '" + JOB_HANDLER_CONFIG_PROPERTY_DELIMITER + "'.");
}
TimerJobConfiguration configuration = new TimerJobConfiguration();
configuration.timerElementKey = configParts[0];
if (configParts.length == 2) {
configuration.followUpJobCreated = JOB_HANDLER_CONFIG_PROPERTY_FOLLOW_UP_JOB_CREATED.equals(configParts[1]);
}
return configuration;
}
use of org.camunda.bpm.engine.impl.jobexecutor.TimerEventJobHandler.TimerJobConfiguration in project camunda-bpm-platform by camunda.
the class MigratingTimerJobInstance method migrateJobHandlerConfiguration.
@Override
protected void migrateJobHandlerConfiguration() {
TimerJobConfiguration configuration = (TimerJobConfiguration) jobEntity.getJobHandlerConfiguration();
configuration.setTimerElementKey(timerTriggerTargetScope.getId());
jobEntity.setJobHandlerConfiguration(configuration);
if (updateEvent) {
targetJobDeclaration.updateJob((TimerEntity) jobEntity);
}
}
use of org.camunda.bpm.engine.impl.jobexecutor.TimerEventJobHandler.TimerJobConfiguration in project camunda-bpm-platform by camunda.
the class TimerEntity method preExecute.
@Override
protected void preExecute(CommandContext commandContext) {
if (getJobHandler() instanceof TimerEventJobHandler) {
TimerJobConfiguration configuration = (TimerJobConfiguration) getJobHandlerConfiguration();
if (repeat != null && !configuration.isFollowUpJobCreated()) {
// this timer is a repeating timer and
// a follow up timer job has not been scheduled yet
Date newDueDate = calculateRepeat();
if (newDueDate != null) {
// the listener is added to the transaction as SYNC on ROLLABCK,
// when it is necessary to schedule a new timer job invocation.
// If the transaction does not rollback, it is ignored.
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew();
RepeatingFailedJobListener listener = createRepeatingFailedJobListener(commandExecutor);
commandContext.getTransactionContext().addTransactionListener(TransactionState.ROLLED_BACK, listener);
// create a new timer job
createNewTimerJob(newDueDate);
}
}
}
}
Aggregations