public final void addJob( String jobName, String groupName, StorageType storageType, org.quartz.Trigger trigger) { JobKey jobKey = new JobKey(jobName, groupName); JobBuilder jobBuilder = JobBuilder.newJob(MessageSenderJob.class); jobBuilder = jobBuilder.withIdentity(jobKey); JobDetail jobDetail = jobBuilder.build(); JobDataMap jobDataMap = jobDetail.getJobDataMap(); jobDataMap.put(SchedulerEngine.MESSAGE, _jsonFactory.serialize(new Message())); jobDataMap.put(SchedulerEngine.DESTINATION_NAME, _TEST_DESTINATION_NAME); jobDataMap.put(SchedulerEngine.STORAGE_TYPE, storageType.toString()); JobState jobState = new JobState(TriggerState.NORMAL); jobState.addException(new Exception(), new Date()); jobDataMap.put(SchedulerEngine.JOB_STATE, JobStateSerializeUtil.serialize(jobState)); _jobs.put(jobKey, new Tuple(jobDetail, trigger, TriggerState.NORMAL)); }
protected void handleException(Message message, Exception exception) { JobState jobState = (JobState) message.get(SchedulerEngine.JOB_STATE); if (jobState != null) { jobState.addException(exception, new Date()); } }