1 package hu.user.mcvodsync.service.schedule;
3 import hu.user.mcvodsync.service.event.ExportCompletedEvent;
4 import hu.user.mcvodsync.service.out.AssetExportService;
5 import lombok.SneakyThrows;
6 import lombok.extern.log4j.Log4j2;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.context.ApplicationEventPublisher;
9 import org.springframework.stereotype.Component;
13 public class ScheduledExport implements Runnable {
15 private ApplicationEventPublisher applicationEventPublisher;
18 private AssetExportService assetExportService;
24 log.info("ScheduledExport started");
25 assetExportService.export();
26 } catch (Exception e) {
27 log.error("ScheduledExport error!", e);
29 applicationEventPublisher.publishEvent(new ExportCompletedEvent(null, this));
30 log.info("ScheduledImport finished");