Closed jvnlee closed 4 months ago
예외 발생으로 인해 FCM 알림 발송 요청에 실패하는 경우, 요청을 재시도하는 로직 추가
Spring Retry 라이브러리 사용
Spring Retry에 대해 정리한 글
send(): 실제 알림 발송 요청을 하는 FirebaseMessaging의 send()를 호출하는 역할.
send()
FirebaseMessaging
@Retryable
MessageSendingFailureException
Spring AOP를 통해 동작하기 때문에 복잡한 구현 없이도 어노테이션 하나로 재시도 명령을 할 수 있음
FirebaseMessagingException
호출부인 NotificationRequestService의 notify()가 구체적인 예외에 의존하지 않게 하기 위함 만약 추후 FCM 대신 다른 알림 발송 모듈을 사용하게 되더라도 코드 변경점을 최소화 할 수 있음
호출부인 NotificationRequestService의 notify()가 구체적인 예외에 의존하지 않게 하기 위함
NotificationRequestService
notify()
만약 추후 FCM 대신 다른 알림 발송 모듈을 사용하게 되더라도 코드 변경점을 최소화 할 수 있음
지정된 횟수의 재시도를 하고나서도 실패한다면 더 이상의 처리가 불가능함
해당 브랜치의 작업은 "재시도 기능 추가"이기 때문에 이에 맞게 feature 태그로 변경했으나, refactor로 되어있는 기존 브랜치 이름은 이미 PR이 올라와있어 정상적으로 변경이 불가능했음.
feature
refactor
구현 내용
예외 발생으로 인해 FCM 알림 발송 요청에 실패하는 경우, 요청을 재시도하는 로직 추가
Spring Retry 라이브러리 사용
Spring Retry에 대해 정리한 글
FirebaseMessagingService
send()
: 실제 알림 발송 요청을 하는FirebaseMessaging
의send()
를 호출하는 역할.@Retryable
을 사용해서MessageSendingFailureException
발생 시 재시도를 수행함.FirebaseMessagingException
발생 시,MessageSendingFailureException
으로 전환해서 되던짐.해결하지 못한 부분
지정된 횟수의 재시도를 하고나서도 실패한다면 더 이상의 처리가 불가능함
etc
해당 브랜치의 작업은 "재시도 기능 추가"이기 때문에 이에 맞게
feature
태그로 변경했으나,refactor
로 되어있는 기존 브랜치 이름은 이미 PR이 올라와있어 정상적으로 변경이 불가능했음.