protected void scheduleTimer(TimerEntity timer) { Context .getCommandContext() .getJobManager() .schedule(timer); }
@Override public Void execute(CommandContext commandContext) { commandContext.getJobManager().delete(jobEntity); return null; } });
public void deleteMonitorJob() { List<JobEntity> monitorJobs = Context.getCommandContext() .getJobManager() .findJobsByJobDefinitionId(monitorJobDefinitionId); for (JobEntity monitorJob : monitorJobs) { monitorJob.delete(); } }
public Object execute(CommandContext commandContext) { JobEntity job = commandContext.getJobManager().findJobById(jobId); if (job != null) { commandContext.getJobManager().delete(job); } return null; } });
@Override public void deleteJobs(BatchEntity batch) { List<JobEntity> jobs = Context.getCommandContext() .getJobManager() .findJobsByJobDefinitionId(batch.getBatchJobDefinitionId()); for (JobEntity job : jobs) { job.delete(); } }
protected void scheduleEventAsync(Object payload, Object payloadLocal, String businessKey) { EventSubscriptionJobDeclaration asyncDeclaration = getJobDeclaration(); if (asyncDeclaration == null) { // fallback to sync if we couldn't find a job declaration processEventSync(payload, payloadLocal, businessKey); } else { MessageEntity message = asyncDeclaration.createJobInstance(this); CommandContext commandContext = Context.getCommandContext(); commandContext.getJobManager().send(message); } }
public JobEntity createMonitorJob(boolean setDueDate) { // Maybe use an other job declaration JobEntity monitorJob = BATCH_MONITOR_JOB_DECLARATION.createJobInstance(this); if (setDueDate) { monitorJob.setDuedate(calculateMonitorJobDueDate()); } Context.getCommandContext() .getJobManager().insertAndHintJobExecutor(monitorJob); return monitorJob; }
@Override public List<JobEntity> execute(CommandContext commandContext) { return commandContext .getJobManager() .findNextJobsToExecute(new Page(0, 100)); } });
@Override public List<JobEntity> execute(CommandContext commandContext) { return commandContext .getJobManager() .findNextJobsToExecute(new Page(0, 100)); } });
public Void execute(CommandContext commandContext) { Date currentTime = ClockUtil.getCurrentTime(); commandContext.getJobManager() .findJobById(job.getId()) .setDuedate(new Date(currentTime.getTime() - 10000)); return null; }
public String execute(CommandContext commandContext) { ensureNotNull("jobId", jobId); JobEntity job = commandContext .getJobManager() .findJobById(jobId); ensureNotNull("No job found with id " + jobId, "job", job); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadJob(job); } return job.getExceptionStacktrace(); }
@Override public List<JobEntity> execute(CommandContext commandContext) { List<JobEntity> jobs = commandContext.getJobManager().findNextJobsToExecute(new Page(0, 100)); for (JobEntity job : jobs) { job.setLockOwner("test"); } return jobs; } });
public String execute(CommandContext commandContext) { MessageEntity message = new MessageEntity(); commandContext.getJobManager().send(message); return message.getId(); } });
public Void execute(CommandContext commandContext) { List<Job> jobs = engineRule.getManagementService().createJobQuery().list(); if (jobs.size() > 0) { assertEquals(1, jobs.size()); String jobId = jobs.get(0).getId(); commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0)); commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId); } return null; } });
public Void execute(CommandContext commandContext) { List<Job> jobs = processEngine.getManagementService().createJobQuery().list(); if (jobs.size() > 0) { String jobId = jobs.get(0).getId(); commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0)); commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId); } return null; } });
public Void execute(CommandContext commandContext) { JobManager jobManager = commandContext.getJobManager(); timerEntity = new TimerEntity(); timerEntity.setLockOwner(UUID.randomUUID().toString()); timerEntity.setDuedate(new Date()); timerEntity.setRetries(0); timerEntity.setExceptionMessage("I'm supposed to fail"); jobManager.insert(timerEntity); assertNotNull(timerEntity.getId()); return null; } });
public Void execute(CommandContext commandContext) { List<Job> jobs = engineRule.getManagementService().createJobQuery().list(); if (jobs.size() > 0) { assertEquals(1, jobs.size()); String jobId = jobs.get(0).getId(); commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0)); commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId); } commandContext.getMeterLogManager().deleteAll(); return null; } });
public Void execute(CommandContext commandContext) { EnsureUtil.ensureNotNull("job id must not be null", "jobId", jobId); JobEntity job = commandContext.getJobManager().findJobById(jobId); EnsureUtil.ensureNotNull(NotFoundException.class, "No job found with id '" + jobId + "'", "job", job); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkUpdateJob(job); } long currentPriority = job.getPriority(); job.setPriority(priority); createOpLogEntry(commandContext, currentPriority, job); return null; }
public Void execute(CommandContext commandContext) { JobManager jobManager = commandContext.getJobManager(); jobManager.send(createTweetMessage("message-one")); jobManager.send(createTweetMessage("message-two")); jobManager.send(createTweetMessage("message-three")); jobManager.send(createTweetMessage("message-four")); jobManager.schedule(createTweetTimer("timer-one", new Date())); jobManager.schedule(createTweetTimer("timer-two", new Date())); return null; } });
public Void execute(CommandContext commandContext) { List<Job> jobs = commandContext.getDbEntityManager().createJobQuery().list(); for (Job job : jobs) { commandContext.getJobManager().deleteJob((JobEntity) job, false); } for (HistoricJobLog jobLog : commandContext.getDbEntityManager().createHistoricJobLogQuery().list()) { commandContext.getHistoricJobLogManager().deleteHistoricJobLogById(jobLog.getId()); } return null; }