-
Notifications
You must be signed in to change notification settings - Fork 6
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
feature : async error handler with slack alarm #322
Conversation
|
||
@Async | ||
public void sendNotification(List<LayoutBlock> layoutBlocks) { | ||
if (!isNeedToNotificationProfile()) { | ||
return; | ||
} | ||
ChatPostMessageRequest chatPostMessageRequest = | ||
ChatPostMessageRequest.builder() | ||
.channel(CHANNEL_ID) | ||
.text("") | ||
.blocks(layoutBlocks) | ||
.build(); | ||
try { | ||
methodsClient.chatPostMessage(chatPostMessageRequest); | ||
} catch (SlackApiException | IOException slackApiException) { | ||
log.error(slackApiException.toString()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
슬랙 프로바이더를
인프라 모듈로 빼었습니다.
import org.springframework.web.util.ContentCachingRequestWrapper; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class SlackApiProvider { | ||
private final MethodsClient methodsClient; | ||
public class SlackInternalErrorSender { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 샌더는
api 모듈에 config 에서 slack 패키지로 위치를 이동시켰습니다
@gengminy 경민형이 아마 여기서 유저랑 우리 를 위한 슬랙 샌더 작업하시면 될것같습니다
ChatPostMessageRequest chatPostMessageRequest = | ||
ChatPostMessageRequest.builder() | ||
.channel(CHANNEL_ID) | ||
.text("") | ||
.blocks(layoutBlocks) | ||
.build(); | ||
try { | ||
methodsClient.chatPostMessage(chatPostMessageRequest); | ||
} catch (SlackApiException slackApiException) { | ||
log.error(slackApiException.toString()); | ||
} | ||
slackProvider.sendNotification(layoutBlocks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layoutBlocks 을 인자로 받아서
보냅니다
비동기 관련 어노테이션은
slackProvider.sendNotification
해당 메소드로 위치시켰습니다.
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
슬랙 설정 이동한 거 확인입니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니당 수고하셨어용
개요
작업사항
변경로직
그리구 앞으로 도메인 이벤트에 롬복 tostring 달아주시면 감사하겠습니다.!
비동기 요청으로 넘어온 파라미터들을 받을 수 있는데
로그로 남겨서 위 사진에 요청 파라미터처럼 내용이보이면 디버깅 하기 더 쉬울듯 합니다!