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

feat: 배치 예외 처리 AOP 구현, 예외 발생 시 Slack에 알림 전송 #59

Merged
merged 3 commits into from
Jul 15, 2023

Conversation

sooyoungh
Copy link
Member

@sooyoungh sooyoungh commented Jul 13, 2023

구현 사항

참고 사항

  • 편의점별 PB, 행사 상품 크롤링 #4
  • PyonsnalcolorBatchException으로 묶어서 AOP에서 예외 처리
  • (다른 기능에서의 IllegalException은 ExceptionHandler로 에러 응답을 클라에게 반환하고,
    배치에서의 IllegalException은 따로 알림등의 처리를 해주기 위해서)
  • 클라 응답용 예외 처리 => @ RestControllerAdvice
  • 배치 관련 부가 기능 => @ Aspect 으로 다음 부가 기능들 일괄적으로 관리할 예정!
    • 예외 발생 시 슬랙 알림
    • 새 상품 업데이트 시 슬랙 알림
    • 시간 측정..?

슬랙에 예외 상황 알림 전송 테스트 참고

image

log 출력

image

@sooyoungh sooyoungh merged commit 5559a17 into develop Jul 15, 2023
2 checks passed
Comment on lines +30 to +33
@AfterThrowing(value = "allBatchService()", throwing = "exception")
public void catchBatchException(JoinPoint joinPoint, PyonsnalcolorBatchException exception) {
log.error("[{}] 배치 실행 중 {}에서 예외가 발생하였습니다.", exception.getClass().getSimpleName(),
joinPoint.getTarget().getClass().getSimpleName());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이후에 @Around으로 바꿔서
크롤링 후에 새 상품 slack 알림, 실패 시 slack 알림 등 일괄 처리하기

@sooyoungh sooyoungh deleted the feature/batch-exception branch August 4, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant