Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix : 처리 실패시 예외 발생 #198

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}

}
Loading