Erweiterungen
This commit is contained in:
@@ -6,11 +6,13 @@ import com.vaadin.flow.theme.Theme;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import java.time.Clock;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
@Theme("default")
|
||||
@Push
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.bson.types.ObjectId;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -27,6 +28,7 @@ public class EmailService {
|
||||
@Value("${spring.mail.username}")
|
||||
private String smtpUsername;
|
||||
|
||||
@Async
|
||||
public void sendTaskCompletionNotification(ObjectId jobId, String taskType, String taskId, String completedBy) {
|
||||
try {
|
||||
// Load job to get context information
|
||||
@@ -146,6 +148,7 @@ public class EmailService {
|
||||
};
|
||||
}
|
||||
|
||||
@Async
|
||||
public void sendJobCompletionNotification(ObjectId jobId, String completedBy) {
|
||||
try {
|
||||
// Load job
|
||||
@@ -226,6 +229,7 @@ public class EmailService {
|
||||
mailSender.send(message);
|
||||
}
|
||||
|
||||
@Async
|
||||
public void sendJobCreationNotification(ObjectId jobId, String createdBy) {
|
||||
try {
|
||||
// Load job
|
||||
@@ -331,6 +335,7 @@ public class EmailService {
|
||||
/**
|
||||
* Send a simple text email
|
||||
*/
|
||||
@Async
|
||||
public void sendSimpleEmail(String to, String subject, String body) {
|
||||
try {
|
||||
SimpleMailMessage message = new SimpleMailMessage();
|
||||
@@ -344,7 +349,6 @@ public class EmailService {
|
||||
|
||||
} catch (Exception 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
server.port=${PORT:8080}
|
||||
server.port=${PORT:8082}
|
||||
server.address=0.0.0.0
|
||||
|
||||
# Default active profile
|
||||
|
||||
Reference in New Issue
Block a user