From 1e8f49b5544117ce92159cfa97f190cc9a7a2de5 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:19:25 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9E=8B=E5=AE=89=E5=85=A8=E3=81=AA?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=96=E3=82=AD=E3=83=A5=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=82=BB=E3=83=83=E3=82=B5=E3=83=BC=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kjobexposed/KJobJobQueueWorkerService.kt | 8 +++----- .../hideout/core/service/job/JobProcessorService.kt | 8 ++++++++ .../hideout/core/service/job/JobQueueWorkerService.kt | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 src/main/kotlin/dev/usbharu/hideout/core/service/job/JobProcessorService.kt diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueWorkerService.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueWorkerService.kt index 98c3a488..8404a2db 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueWorkerService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/KJobJobQueueWorkerService.kt @@ -1,14 +1,14 @@ package dev.usbharu.hideout.core.infrastructure.kjobexposed +import dev.usbharu.hideout.core.external.job.HideoutJob import dev.usbharu.hideout.core.service.job.JobQueueWorkerService +import kjob.core.dsl.JobContextWithProps import kjob.core.dsl.JobRegisterContext import kjob.core.dsl.KJobFunctions import kjob.core.kjob import org.jetbrains.exposed.sql.transactions.TransactionManager import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.stereotype.Service -import dev.usbharu.hideout.core.external.job.HideoutJob as HJ -import kjob.core.dsl.JobContextWithProps as JCWP @Service @ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "false", matchIfMissing = true) @@ -23,9 +23,7 @@ class KJobJobQueueWorkerService() : JobQueueWorkerService { }.start() } - override fun init( - defines: List>.(HJ) -> KJobFunctions>>> - ) { + override fun > init(defines: List>.(R) -> KJobFunctions>>>) { defines.forEach { job -> kjob.register(job.first, job.second) } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobProcessorService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobProcessorService.kt new file mode 100644 index 00000000..07798007 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobProcessorService.kt @@ -0,0 +1,8 @@ +package dev.usbharu.hideout.core.service.job + +import dev.usbharu.hideout.core.external.job.HideoutJob + +interface JobProcessorService> { + suspend fun process(param: T) + suspend fun job(): Class +} diff --git a/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt b/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt index 982dbeb0..9496470e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/service/job/JobQueueWorkerService.kt @@ -8,7 +8,7 @@ import kjob.core.dsl.JobRegisterContext as JRC @Service interface JobQueueWorkerService { - fun init( - defines: List>.(HJ) -> KJobFunctions>>> + fun > init( + defines: List>.(R) -> KJobFunctions>>> ) }