-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Refactor/#358] 아티클 읽음 기록 이벤트 처리로 리펙토링 #359
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ed6abb6
feat: ReadArticleEvent 생성 및 처리 구현
belljun3395 0fa2e91
refactor: 기존 구현 이벤트 방식으로 수정
belljun3395 a027599
chore: ReadArticlesUseCase -> BrowseArticlesUseCase로 컨벤션 통일
belljun3395 3b4db93
chore: 불필요 주석 제거
belljun3395 5f3d0f7
Merge branch 'dev' into refactor/#358_belljun3395
belljun3395 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
17 changes: 17 additions & 0 deletions
17
api/src/main/kotlin/com/few/api/domain/article/event/ReadArticleEventListener.kt
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,17 @@ | ||
package com.few.api.domain.article.event | ||
|
||
import com.few.api.domain.article.event.dto.ReadArticleEvent | ||
import com.few.api.domain.article.handler.ArticleViewHisAsyncHandler | ||
import org.springframework.context.event.EventListener | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class ReadArticleEventListener( | ||
private val articleViewHisAsyncHandler: ArticleViewHisAsyncHandler, | ||
) { | ||
|
||
@EventListener | ||
fun handleEvent(event: ReadArticleEvent) { | ||
articleViewHisAsyncHandler.addArticleViewHis(event.articleId, event.memberId, event.category) | ||
} | ||
Comment on lines
+13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1차적으로 EventListener에서 이벤트를 받습니다. |
||
} |
9 changes: 9 additions & 0 deletions
9
api/src/main/kotlin/com/few/api/domain/article/event/dto/ReadArticleEvent.kt
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,9 @@ | ||
package com.few.api.domain.article.event.dto | ||
|
||
import com.few.data.common.code.CategoryType | ||
|
||
data class ReadArticleEvent( | ||
val articleId: Long, | ||
val memberId: Long, | ||
val category: CategoryType, | ||
) |
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
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
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
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.
EventListener에서 받은 이벤트를 2차로 처리합니다.
eg)
articleViewHisAsyncHandler.addArticleViewHis는 이벤트를 비동기로 처리함
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.
이렇게 처리하는게 추후 이벤트를 처리하는 로직이 추가될 때 대응하기 편할 것 같아서 이벤트 처리를 현재 구현과 같이 통일하려 합니다.