Skip to content

Commit 7292db0

Browse files
authored
feat : 문제 출제 실패 시, 메일 발송 실패 로그 저장 추가 (#424)
* feat : 문제 출제 실패 시, 메일 발송 실패 로그 저장 추가 * chore : 테스트용 설정 제거
1 parent c723900 commit 7292db0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cs25-batch/src/main/java/com/example/cs25batch/batch/component/processor/MailConsumerAsyncProcessor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import com.example.cs25batch.adapter.RedisStreamsClient;
44
import com.example.cs25batch.batch.dto.MailDto;
5+
import com.example.cs25batch.batch.service.MailLogBatchService;
56
import com.example.cs25batch.batch.service.TodayQuizService;
67
import com.example.cs25entity.domain.quiz.entity.Quiz;
78
import com.example.cs25entity.domain.quiz.exception.QuizException;
89
import com.example.cs25entity.domain.subscription.entity.Subscription;
910
import com.example.cs25entity.domain.subscription.repository.SubscriptionRepository;
11+
import java.time.LocalDateTime;
1012
import java.util.Map;
1113
import lombok.RequiredArgsConstructor;
1214
import lombok.extern.slf4j.Slf4j;
@@ -21,6 +23,7 @@ public class MailConsumerAsyncProcessor implements ItemProcessor<Map<String, Str
2123
private final SubscriptionRepository subscriptionRepository;
2224
private final TodayQuizService todayQuizService;
2325
private final RedisStreamsClient redisClient;
26+
private final MailLogBatchService mailLogBatchService;
2427

2528
@Override
2629
public MailDto process(Map<String, String> message) throws Exception {
@@ -49,6 +52,7 @@ public MailDto process(Map<String, String> message) throws Exception {
4952
.build();
5053
} catch(QuizException e){
5154
//문제 출제 실패로 인한 예외 발생 시, 기존 Queue에 있는 데이터 삭제
55+
mailLogBatchService.saveFailLog(subscription, null, LocalDateTime.now(), "No quizzes available");
5256
redisClient.ackAndDel(recordId);
5357
return null;
5458
}

0 commit comments

Comments
 (0)