implemented scheduled worker that processes queued notifications

This commit is contained in:
2026-01-13 16:42:31 +01:00
parent bef418d77d
commit 06aa0ce3cc
14 changed files with 225 additions and 104 deletions
@@ -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);
}
}
}