-
Notifications
You must be signed in to change notification settings - Fork 0
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
[#54] 카프카를 통한 이벤트 기반 통신 구현 #57
Conversation
|
||
public class EventConstants { | ||
|
||
public static final String GROUP_MEMBER_INCREASE_REQUEST = "dev.group.payment.request.increase-group-size"; |
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.
상수를 통해 카프카 토픽을 관리함으로써 human error
를 방지합니다.
*/ | ||
@Modifying | ||
@Query("update Group g set g.groupSize = :groupSize where g.id = :id") | ||
void updateGroupSize(@Param("id") Long id, @Param("groupSize") Integer groupSize); |
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.
해당 메소드는 동시성 문제 발생 가능성이 있습니다.
update
기능은 JPA
의 Dirty Checking
을 통해서도 구현 가능하지만, entity에서 해당 기능을 호출할 수 있으므로 실수를 범할 가능성이 크다고 생각했습니다.
이에 동시성 문제가 발생할 수 있는 command
를 Repository
로 분리하는 방법을 사용해보았습니다.
두 마이크로서비스에서 공통적으로 사용되는 로직들이 다수 존재합니다. |
개발 내용
payment-service
와 통신결제 요청
->결제 완료
->그룹 인원 증가
흐름 구현개발 코멘트
common-library
로 추출해야 합니다.