Erweiterungen

This commit is contained in:
2026-02-09 11:11:14 +01:00
parent 7b878b4f2a
commit 6d43421544
3 changed files with 8 additions and 2 deletions

View File

@@ -6,11 +6,13 @@ import com.vaadin.flow.theme.Theme;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import java.time.Clock; import java.time.Clock;
@SpringBootApplication @SpringBootApplication
@EnableAsync
@EnableScheduling @EnableScheduling
@Theme("default") @Theme("default")
@Push @Push

View File

@@ -11,6 +11,7 @@ import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Optional; import java.util.Optional;
@@ -27,6 +28,7 @@ public class EmailService {
@Value("${spring.mail.username}") @Value("${spring.mail.username}")
private String smtpUsername; private String smtpUsername;
@Async
public void sendTaskCompletionNotification(ObjectId jobId, String taskType, String taskId, String completedBy) { public void sendTaskCompletionNotification(ObjectId jobId, String taskType, String taskId, String completedBy) {
try { try {
// Load job to get context information // Load job to get context information
@@ -146,6 +148,7 @@ public class EmailService {
}; };
} }
@Async
public void sendJobCompletionNotification(ObjectId jobId, String completedBy) { public void sendJobCompletionNotification(ObjectId jobId, String completedBy) {
try { try {
// Load job // Load job
@@ -226,6 +229,7 @@ public class EmailService {
mailSender.send(message); mailSender.send(message);
} }
@Async
public void sendJobCreationNotification(ObjectId jobId, String createdBy) { public void sendJobCreationNotification(ObjectId jobId, String createdBy) {
try { try {
// Load job // Load job
@@ -331,6 +335,7 @@ public class EmailService {
/** /**
* Send a simple text email * Send a simple text email
*/ */
@Async
public void sendSimpleEmail(String to, String subject, String body) { public void sendSimpleEmail(String to, String subject, String body) {
try { try {
SimpleMailMessage message = new SimpleMailMessage(); SimpleMailMessage message = new SimpleMailMessage();
@@ -344,7 +349,6 @@ public class EmailService {
} catch (Exception e) { } catch (Exception e) {
log.error("Failed to send simple email to {} with subject '{}': {}", to, subject, e.getMessage(), e); log.error("Failed to send simple email to {} with subject '{}': {}", to, subject, e.getMessage(), e);
throw new RuntimeException("Failed to send email: " + e.getMessage(), e);
} }
} }
} }

View File

@@ -1,4 +1,4 @@
server.port=${PORT:8080} server.port=${PORT:8082}
server.address=0.0.0.0 server.address=0.0.0.0
# Default active profile # Default active profile