-
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
[LIME-20] 포인트 지급 처리를 AOP -> Event로 변경 #28
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
lime-api/src/main/java/com/programmers/lime/global/event/point/PointEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.programmers.lime.global.event.point; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class PointEvent { | ||
|
||
private final Long memberId; | ||
private final int point; | ||
} |
22 changes: 22 additions & 0 deletions
22
lime-api/src/main/java/com/programmers/lime/global/event/point/PointEventListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.programmers.lime.global.event.point; | ||
|
||
import org.springframework.context.event.EventListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.programmers.lime.domains.member.domain.Member; | ||
import com.programmers.lime.domains.member.implementation.MemberReader; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class PointEventListener { | ||
|
||
private final MemberReader memberReader; | ||
|
||
@EventListener | ||
public void earnPoint(final PointEvent pointEvent) { | ||
final Member member = memberReader.read(pointEvent.getMemberId()); | ||
member.earnPoint(pointEvent.getPoint()); | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
lime-api/src/main/java/com/programmers/lime/global/level/PayPoint.java
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
lime-api/src/main/java/com/programmers/lime/global/level/PointManagerAop.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
제가 알기론 비동기 처리를 할 경우 별도의 스레드로 실행되어 다른 트랜잭션에서 처리되는 것으로 압니다! 포인트 지급은 별도의 트랜잭션이 아닌 동일 트랜잭션에서 처리하기로 결정해서 비동기 처리는 안했습니다 😊
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.
TransactionSynchronizationManager 라는 곳에서 ThreadLocal로 관리하기 때문에 트랜잭션 레벨을 조정해도 부모 트랜잭션 정보를 얻을 수 없어 예외가 발생한다는 내용이 있네요!
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.
오 재현님 덕분에 TransactionSynchronizationManager 처음 알게되었는데 저런 것도 있군요! 인사이트 감사합니다😊
위와 같이 이해했는데 맞을까요!?