-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use scheduler rather than Thread to handle the generation of error re…
…port emails.
- Loading branch information
1 parent
40655b5
commit 9df938f
Showing
4 changed files
with
83 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
visa-scheduler/src/main/java/eu/ill/visa/scheduler/jobs/ErrorReporterJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package eu.ill.visa.scheduler.jobs; | ||
|
||
import eu.ill.visa.business.notification.logging.filters.ErrorReporter; | ||
import io.quarkus.scheduler.Scheduled; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@ApplicationScoped | ||
public class ErrorReporterJob { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(ErrorReporterJob.class); | ||
|
||
private final ErrorReporter errorReporter; | ||
|
||
@Inject | ||
public ErrorReporterJob(final ErrorReporter errorReporter) { | ||
this.errorReporter = errorReporter; | ||
} | ||
|
||
@Scheduled(cron="5/10 * * ? * *", concurrentExecution = Scheduled.ConcurrentExecution.SKIP) | ||
public void maxErrorsScheduler() { | ||
this.errorReporter.handleMaxErrors(); | ||
} | ||
|
||
@Scheduled(cron="0 * * ? * *", concurrentExecution = Scheduled.ConcurrentExecution.SKIP) | ||
public void minuteScheduler() { | ||
this.errorReporter.handleCurrentErrors(); | ||
} | ||
} |