Skip to content

Commit

Permalink
Fix : 처리 실패시 예외 발생 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunw9 authored Sep 6, 2024
1 parent bf78932 commit a536751
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.clody.domain.reply.dto.DequeuedMessage;
import com.clody.domain.reply.repository.ReplyRepository;
import com.clody.domain.reply.service.RodyProcessor;
import com.clody.support.exception.NotFoundException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
Expand All @@ -19,12 +20,20 @@ public class RodyMessageProcessor {

@EventListener
public void sendDequeuedMessageToRody(DequeuedMessage message){
Reply reply = replyRepository.findById(message.replyId());
if(reply.checkReplyDeleted()){
log.info("Deleted reply: {}", reply.getId());
return;
try {
Reply reply = replyRepository.findById(message.replyId());

if (reply.checkReplyDeleted()) {
log.info("Deleted reply: {}", reply.getId());
return;
}

rodyProcessor.createReply(message);
} catch (NotFoundException e) {
log.info("Reply 발견 실패 : {}. 프로세스 스킵.", message.replyId());
} catch (Exception e) {
log.error("처리 중 오류가 발생했습니다. Reply Id: {}. Error: {}", message.replyId(), e.getMessage());
}
rodyProcessor.createReply(message);
}

}

0 comments on commit a536751

Please sign in to comment.