22
33import com .example .cs25batch .adapter .RedisStreamsClient ;
44import com .example .cs25batch .batch .dto .MailDto ;
5+ import com .example .cs25batch .batch .service .MailLogBatchService ;
56import com .example .cs25batch .batch .service .TodayQuizService ;
67import com .example .cs25entity .domain .quiz .entity .Quiz ;
78import com .example .cs25entity .domain .quiz .exception .QuizException ;
89import com .example .cs25entity .domain .subscription .entity .Subscription ;
910import com .example .cs25entity .domain .subscription .repository .SubscriptionRepository ;
11+ import java .time .LocalDateTime ;
1012import java .util .Map ;
1113import lombok .RequiredArgsConstructor ;
1214import 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