feat: Inboxのジョブキューを型安全ジョブキュー実装に切り替え

This commit is contained in:
usbharu 2023-11-26 13:17:49 +09:00
parent 25b689b73a
commit abce56e52d
2 changed files with 24 additions and 14 deletions

View File

@ -7,7 +7,9 @@ import dev.usbharu.hideout.activitypub.service.common.ActivityType
import dev.usbharu.hideout.activitypub.service.objects.user.APUserService
import dev.usbharu.hideout.core.domain.exception.FailedToGetResourcesException
import dev.usbharu.hideout.core.external.job.InboxJob
import dev.usbharu.hideout.core.external.job.InboxJobParam
import dev.usbharu.hideout.core.query.UserQueryService
import dev.usbharu.hideout.core.service.job.JobProcessor
import dev.usbharu.hideout.util.RsaUtil
import dev.usbharu.httpsignature.common.HttpHeaders
import dev.usbharu.httpsignature.common.HttpRequest
@ -27,7 +29,7 @@ class InboxJobProcessor(
private val signatureVerifier: HttpSignatureVerifier,
private val userQueryService: UserQueryService,
private val apUserService: APUserService
) {
) : JobProcessor<InboxJobParam, InboxJob> {
suspend fun process(props: JobProps<InboxJob>) {
val type = ActivityType.valueOf(props[InboxJob.type])
@ -90,6 +92,13 @@ class InboxJobProcessor(
}
}
override suspend fun process(param: InboxJobParam) {
println(param)
System.err.println("aaaaaaaaaaaaaaaaaaaaaaaaaaa")
}
override fun job(): InboxJob = InboxJob
companion object {
private val logger = LoggerFactory.getLogger(InboxJobProcessor::class.java)
}

View File

@ -34,19 +34,20 @@ class JobQueueWorkerRunner(
) : ApplicationRunner {
override fun run(args: ApplicationArguments?) {
LOGGER.info("Init job queue worker.")
jobQueueWorkerService.init(
jobs.map {
it to {
execute {
LOGGER.debug("excute job ${it.name}")
apJobService.processActivity(
job = this,
hideoutJob = it
)
}
}
}
)
// jobQueueWorkerService.init<Any?, HideoutJob<*, *>>(
// jobs.map {
// it to {
// execute {
// LOGGER.debug("excute job ${it.name}")
// apJobService.processActivity(
// job = this,
// hideoutJob = it
// )
// }
// }
// }
// )
jobQueueWorkerService.init<Any?, HideoutJob<*, *>>(emptyList())
}
companion object {