Skip to content

Commit

Permalink
feat: 이벤트 비동기로 실행하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
seokjin8678 committed Jan 5, 2024
1 parent 4e966ee commit 5942f07
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/kotlin/kr/galaxyhub/sc/common/config/AsyncConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package kr.galaxyhub.sc.common.config

import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.EnableAsync

@EnableAsync
@Configuration
class AsyncConfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import java.util.UUID
import kr.galaxyhub.sc.news.domain.Language
import kr.galaxyhub.sc.news.domain.NewsInformation
import org.springframework.context.event.EventListener
import org.springframework.scheduling.annotation.Async
import org.springframework.stereotype.Component

private val log = KotlinLogging.logger {}
Expand All @@ -18,6 +19,7 @@ class NewsAppendContentEventListener(
private val newsCommandService: NewsCommandService,
) {

@Async
@EventListener
fun newsAppendContentEventHandler(event: NewsAppendContentEvent) {
val (newsId, newsInformation, content, language) = event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kr.galaxyhub.sc.translation.application
import io.github.oshai.kotlinlogging.KotlinLogging
import java.util.UUID
import org.springframework.context.event.EventListener
import org.springframework.scheduling.annotation.Async
import org.springframework.stereotype.Component

private val log = KotlinLogging.logger {}
Expand All @@ -18,6 +19,7 @@ class TranslateResultEventListener(
private val translateProgressionStatusChangeService: TranslateProgressionStatusChangeService,
) {

@Async
@EventListener
fun translateSuccessEventHandler(event: TranslateSuccessEvent) {
try {
Expand All @@ -27,6 +29,7 @@ class TranslateResultEventListener(
}
}

@Async
@EventListener
fun translateFailureEventHandler(event: TranslateFailureEvent) {
try {
Expand Down

0 comments on commit 5942f07

Please sign in to comment.