implemented scheduled worker that processes queued notifications
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package SuMoC.backend.scheduling;
|
||||
|
||||
import SuMoC.backend.notification.services.NotificationWorker;
|
||||
import SuMoC.backend.trend.services.StatTableUpdateService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
@@ -19,6 +20,8 @@ public class ScheduledTasks {
|
||||
|
||||
private final StatTableUpdateService statTableUpdateService;
|
||||
|
||||
private final NotificationWorker notificationWorker;
|
||||
|
||||
@Scheduled(cron = "#{@schedulingProperties.calculateWeeklyMobilityStats}")
|
||||
public void scheduleCalculateWeeklyMobilityStats() {
|
||||
logger.info("Scheduled task triggered: calculateWeeklyMobilityStatsForAllUsers");
|
||||
@@ -29,4 +32,14 @@ public class ScheduledTasks {
|
||||
logger.error("Error calculating weekly mobility stats.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "#{@schedulingProperties.runNotificationWorker}")
|
||||
public void scheduleRunNotificationWorker() {
|
||||
logger.info("Scheduled task triggered: runNotificationWorker");
|
||||
try {
|
||||
notificationWorker.run();
|
||||
} catch (Exception e) {
|
||||
logger.error("Error running notification worker.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user