implement full service chain where scheduled task detects regular trips every day and schedules notifications with better alternatives if available
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good

This commit is contained in:
2026-01-16 13:19:19 +01:00
parent b08d9dd22d
commit d099909aab
13 changed files with 299 additions and 24 deletions
@@ -1,6 +1,7 @@
package SuMoC.backend.scheduling;
import SuMoC.backend.notification.services.NotificationWorker;
import SuMoC.backend.suggestion.services.RegularTripSuggestionService;
import SuMoC.backend.trend.services.StatTableUpdateService;
import SuMoC.backend.trend.services.TrendNotificationService;
import lombok.RequiredArgsConstructor;
@@ -23,6 +24,8 @@ public class ScheduledTasks {
private final TrendNotificationService trendNotificationService;
private final RegularTripSuggestionService regularTripSuggestionService;
private final NotificationWorker notificationWorker;
/**
@@ -65,4 +68,17 @@ public class ScheduledTasks {
logger.error("Error cleaning up old notifications.", e);
}
}
/**
* Detect regular routes for all users and plan notifications for better alternatives.
*/
@Scheduled(cron = "#{@schedulingProperties.notifyRegularRouteAlternatives}")
public void scheduleNotifyRegularRouteAlternatives() {
logger.info("Scheduled task triggered: notifyRegularRouteAlternatives");
try {
regularTripSuggestionService.detectAndNotifyRegularTripsForTodaysDayOfWeek();
} catch (Exception e) {
logger.error("Error notifying regular route alternatives.", e);
}
}
}