/** Registers the trigger. */ @PostConstruct public void registerTrigger() { schedulerHelperService.registerScheduledCall( "CommonReferenceUpdateEvent", () -> eventManager.fire(new CommonReferenceUpdateEvent()), DateTimeUtil.millisecondDelayUntilNextTime( new LocalTime(configDso.getProperty(ConfigDsoParam.DSO_COMMON_REFERENCE_UPDATE_TIME))), TimeUnit.DAYS.toMillis(1)); }
/** * Registers a trigger in the {@link SchedulerHelperService} that will repeatedly call the * workflow on a certain time. */ @PostConstruct public void scheduleTrigger() { schedulerHelperService.registerScheduledCall( "DsoInitiateSettlement", () -> { int dayOfMonth = DateTimeUtil.getCurrentDate().getDayOfMonth(); int settlementDay = Integer.parseInt( configDso.getProperty(ConfigDsoParam.DSO_INITIATE_SETTLEMENT_DAY_OF_MONTH)); LOGGER.debug("Checking day of month: {} with {} ", settlementDay, dayOfMonth); if (dayOfMonth == settlementDay) { eventManager.fire(new CollectSmartMeterDataEvent()); } }, createInitialDelay(), createIntervalPeriod()); }
private long createInitialDelay() { return DateTimeUtil.millisecondDelayUntilNextTime( new LocalTime(configDso.getProperty(ConfigDsoParam.DSO_INITIATE_SETTLEMENT_TIME))); }