@Test
  @DirtiesContext
  public void testSpringBeanProperlyInjectedInAnnotatedSaga_Again() throws Exception {
    eventBus.publish(GenericEventMessage.asEventMessage(new SimpleEvent("test")));

    // both the sync and async should invoke the executor
    verify(executor, timeout(1000).times(2)).execute(isA(Runnable.class));
  }
コード例 #2
0
 @Override
 public ScheduleToken schedule(Instant triggerDateTime, Object event) {
   Assert.state(initialized, () -> "Scheduler is not yet initialized");
   EventMessage eventMessage = GenericEventMessage.asEventMessage(event);
   String jobIdentifier = JOB_NAME_PREFIX + eventMessage.getIdentifier();
   QuartzScheduleToken tr = new QuartzScheduleToken(jobIdentifier, groupIdentifier);
   try {
     JobDetail jobDetail =
         buildJobDetail(eventMessage, new JobKey(jobIdentifier, groupIdentifier));
     scheduler.scheduleJob(jobDetail, buildTrigger(triggerDateTime, jobDetail.getKey()));
   } catch (SchedulerException e) {
     throw new SchedulingException("An error occurred while setting a timer for a saga", e);
   }
   return tr;
 }