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.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
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user