feat: ジョブキューをOWLに切り替え

This commit is contained in:
usbharu 2024-05-04 18:28:01 +09:00
parent 0b29c3356a
commit 3a541fa4b0
35 changed files with 236 additions and 118 deletions

View File

@ -31,22 +31,22 @@ version = "0.0.1"
sourceSets {
create("intTest") {
test {
// test {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
kotlin.srcDirs("src/intTest/kotlin")
java.srcDirs("src/intTest/java")
resources.srcDirs("src/intTest/resources")
}
// }
}
create("e2eTest") {
test {
// test {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
kotlin.srcDirs("src/e2eTest/kotlin")
java.srcDirs("src/e2eTest/java")
resources.srcDirs("src/e2eTest/resources")
}
// }
}
}
@ -263,7 +263,7 @@ dependencies {
detekt {
parallel = true
config = files("detekt.yml")
config = files("../detekt.yml")
buildUponDefaultConfig = true
basePath = "${rootDir.absolutePath}/src/main/kotlin"
autoCorrect = true
@ -286,14 +286,6 @@ tasks.withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>().configure
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
configurations.matching { it.name == "detekt" }.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion("1.9.22")
}
}
}
configurations {
all {
exclude("org.springframework.boot", "spring-boot-starter-logging")

View File

@ -19,9 +19,8 @@ package dev.usbharu.hideout.activitypub.service.activity.accept
import dev.usbharu.hideout.activitypub.domain.model.Accept
import dev.usbharu.hideout.activitypub.domain.model.Follow
import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.external.job.DeliverAcceptJob
import dev.usbharu.hideout.core.external.job.DeliverAcceptJobParam
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.owl.producer.api.OwlProducer
import org.springframework.stereotype.Service
interface ApSendAcceptService {
@ -30,8 +29,7 @@ interface ApSendAcceptService {
@Service
class ApSendAcceptServiceImpl(
private val jobQueueParentService: JobQueueParentService,
private val deliverAcceptJob: DeliverAcceptJob
private val owlProducer: OwlProducer,
) : ApSendAcceptService {
override suspend fun sendAcceptFollow(actor: Actor, target: Actor) {
val deliverAcceptJobParam = DeliverAcceptJobParam(
@ -46,6 +44,6 @@ class ApSendAcceptServiceImpl(
actor.id
)
jobQueueParentService.scheduleTypeSafe(deliverAcceptJob, deliverAcceptJobParam)
owlProducer.publishTask(deliverAcceptJobParam)
}
}

View File

@ -21,9 +21,8 @@ import dev.usbharu.hideout.activitypub.domain.model.Follow
import dev.usbharu.hideout.activitypub.domain.model.Reject
import dev.usbharu.hideout.application.config.ApplicationConfig
import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.external.job.DeliverBlockJob
import dev.usbharu.hideout.core.external.job.DeliverBlockJobParam
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.owl.producer.api.OwlProducer
import org.springframework.stereotype.Service
interface APSendBlockService {
@ -33,8 +32,7 @@ interface APSendBlockService {
@Service
class ApSendBlockServiceImpl(
private val applicationConfig: ApplicationConfig,
private val jobQueueParentService: JobQueueParentService,
private val deliverBlockJob: DeliverBlockJob
private val owlProducer: OwlProducer,
) : APSendBlockService {
override suspend fun sendBlock(actor: Actor, target: Actor) {
val blockJobParam = DeliverBlockJobParam(
@ -54,6 +52,6 @@ class ApSendBlockServiceImpl(
),
target.inbox
)
jobQueueParentService.scheduleTypeSafe(deliverBlockJob, blockJobParam)
owlProducer.publishTask(blockJobParam)
}
}

View File

@ -24,9 +24,10 @@ import dev.usbharu.hideout.core.domain.exception.resource.PostNotFoundException
import dev.usbharu.hideout.core.domain.exception.resource.UserNotFoundException
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
import dev.usbharu.hideout.core.domain.model.post.Post
import dev.usbharu.hideout.core.external.job.DeliverPostJob
import dev.usbharu.hideout.core.external.job.DeliverPostTask
import dev.usbharu.hideout.core.query.FollowerQueryService
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.owl.producer.api.OwlProducer
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@ -37,7 +38,8 @@ class ApSendCreateServiceImpl(
private val jobQueueParentService: JobQueueParentService,
private val noteQueryService: NoteQueryService,
private val applicationConfig: ApplicationConfig,
private val actorRepository: ActorRepository
private val actorRepository: ActorRepository,
private val owlProducer: OwlProducer,
) : ApSendCreateService {
override suspend fun createNote(post: Post) {
logger.info("CREATE Create Local Note ${post.url}")
@ -56,11 +58,7 @@ class ApSendCreateServiceImpl(
id = "${applicationConfig.url}/create/note/${post.id}"
)
followers.forEach { followerEntity ->
jobQueueParentService.schedule(DeliverPostJob) {
props[DeliverPostJob.actor] = userEntity.url
props[DeliverPostJob.inbox] = followerEntity.inbox
props[DeliverPostJob.create] = objectMapper.writeValueAsString(create)
}
owlProducer.publishTask(DeliverPostTask(create, userEntity.url, followerEntity.inbox))
}
logger.debug("SUCCESS Create Local Note ${post.url}")

View File

@ -24,10 +24,9 @@ import dev.usbharu.hideout.core.domain.exception.resource.UserNotFoundException
import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
import dev.usbharu.hideout.core.domain.model.post.Post
import dev.usbharu.hideout.core.external.job.DeliverDeleteJob
import dev.usbharu.hideout.core.external.job.DeliverDeleteJobParam
import dev.usbharu.hideout.core.query.FollowerQueryService
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.owl.producer.api.OwlProducer
import org.springframework.stereotype.Service
import java.time.Instant
@ -38,11 +37,10 @@ interface APSendDeleteService {
@Service
class APSendDeleteServiceImpl(
private val jobQueueParentService: JobQueueParentService,
private val delverDeleteJob: DeliverDeleteJob,
private val followerQueryService: FollowerQueryService,
private val applicationConfig: ApplicationConfig,
private val actorRepository: ActorRepository
private val actorRepository: ActorRepository,
private val owlProducer: OwlProducer,
) : APSendDeleteService {
override suspend fun sendDeleteNote(deletedPost: Post) {
val actor =
@ -62,7 +60,8 @@ class APSendDeleteServiceImpl(
it.inbox,
actor.id
)
jobQueueParentService.scheduleTypeSafe(delverDeleteJob, jobProps)
owlProducer.publishTask(jobProps)
}
}

View File

@ -22,16 +22,15 @@ import dev.usbharu.hideout.activitypub.service.common.AbstractActivityPubProcess
import dev.usbharu.hideout.activitypub.service.common.ActivityPubProcessContext
import dev.usbharu.hideout.activitypub.service.common.ActivityType
import dev.usbharu.hideout.application.external.Transaction
import dev.usbharu.hideout.core.external.job.ReceiveFollowJob
import dev.usbharu.hideout.core.external.job.ReceiveFollowJobParam
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.owl.producer.api.OwlProducer
import org.springframework.stereotype.Service
@Service
class APFollowProcessor(
transaction: Transaction,
private val jobQueueParentService: JobQueueParentService,
private val objectMapper: ObjectMapper
private val objectMapper: ObjectMapper,
private val owlProducer: OwlProducer,
) :
AbstractActivityPubProcessor<Follow>(transaction) {
override suspend fun internalProcess(activity: ActivityPubProcessContext<Follow>) {
@ -43,7 +42,7 @@ class APFollowProcessor(
objectMapper.writeValueAsString(activity.activity),
activity.activity.apObject
)
jobQueueParentService.scheduleTypeSafe(ReceiveFollowJob, jobProps)
owlProducer.publishTask(jobProps)
}
override fun isSupported(activityType: ActivityType): Boolean = activityType == ActivityType.Follow

View File

@ -16,12 +16,10 @@
package dev.usbharu.hideout.activitypub.service.activity.follow
import com.fasterxml.jackson.databind.ObjectMapper
import dev.usbharu.hideout.activitypub.domain.model.Follow
import dev.usbharu.hideout.core.external.job.ReceiveFollowJob
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.hideout.core.external.job.ReceiveFollowTask
import dev.usbharu.owl.producer.api.OwlProducer
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Service
interface APReceiveFollowService {
@ -30,16 +28,11 @@ interface APReceiveFollowService {
@Service
class APReceiveFollowServiceImpl(
private val jobQueueParentService: JobQueueParentService,
@Qualifier("activitypub") private val objectMapper: ObjectMapper
private val owlProducer: OwlProducer,
) : APReceiveFollowService {
override suspend fun receiveFollow(follow: Follow) {
logger.info("FOLLOW from: {} to: {}", follow.actor, follow.apObject)
jobQueueParentService.schedule(ReceiveFollowJob) {
props[ReceiveFollowJob.actor] = follow.actor
props[ReceiveFollowJob.follow] = objectMapper.writeValueAsString(follow)
props[ReceiveFollowJob.targetActor] = follow.apObject
}
owlProducer.publishTask(ReceiveFollowTask(follow.actor, follow, follow.apObject))
return
}

View File

@ -16,17 +16,15 @@
package dev.usbharu.hideout.activitypub.service.activity.like
import com.fasterxml.jackson.databind.ObjectMapper
import dev.usbharu.hideout.core.domain.exception.resource.PostNotFoundException
import dev.usbharu.hideout.core.domain.exception.resource.UserNotFoundException
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
import dev.usbharu.hideout.core.domain.model.post.PostRepository
import dev.usbharu.hideout.core.domain.model.reaction.Reaction
import dev.usbharu.hideout.core.external.job.DeliverReactionJob
import dev.usbharu.hideout.core.external.job.DeliverRemoveReactionJob
import dev.usbharu.hideout.core.external.job.DeliverReactionTask
import dev.usbharu.hideout.core.external.job.DeliverRemoveReactionTask
import dev.usbharu.hideout.core.query.FollowerQueryService
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import org.springframework.beans.factory.annotation.Qualifier
import dev.usbharu.owl.producer.api.OwlProducer
import org.springframework.stereotype.Service
interface APReactionService {
@ -36,11 +34,10 @@ interface APReactionService {
@Service
class APReactionServiceImpl(
private val jobQueueParentService: JobQueueParentService,
private val followerQueryService: FollowerQueryService,
private val actorRepository: ActorRepository,
@Qualifier("activitypub") private val objectMapper: ObjectMapper,
private val postRepository: PostRepository
private val postRepository: PostRepository,
private val owlProducer: OwlProducer,
) : APReactionService {
override suspend fun reaction(like: Reaction) {
val followers = followerQueryService.findFollowersById(like.actorId)
@ -48,13 +45,15 @@ class APReactionServiceImpl(
val post =
postRepository.findById(like.postId) ?: throw PostNotFoundException.withId(like.postId)
followers.forEach { follower ->
jobQueueParentService.schedule(DeliverReactionJob) {
props[DeliverReactionJob.actor] = user.url
props[DeliverReactionJob.reaction] = ""
props[DeliverReactionJob.inbox] = follower.inbox
props[DeliverReactionJob.postUrl] = post.url
props[DeliverReactionJob.id] = post.id.toString()
}
owlProducer.publishTask(
DeliverReactionTask(
actor = user.url,
reaction = "",
inbox = follower.inbox,
postUrl = post.url,
id = post.id
)
)
}
}
@ -64,12 +63,14 @@ class APReactionServiceImpl(
val post =
postRepository.findById(like.postId) ?: throw PostNotFoundException.withId(like.postId)
followers.forEach { follower ->
jobQueueParentService.schedule(DeliverRemoveReactionJob) {
props[DeliverRemoveReactionJob.actor] = user.url
props[DeliverRemoveReactionJob.inbox] = follower.inbox
props[DeliverRemoveReactionJob.id] = post.id.toString()
props[DeliverRemoveReactionJob.like] = objectMapper.writeValueAsString(like)
}
owlProducer.publishTask(
DeliverRemoveReactionTask(
actor = user.url,
inbox = follower.inbox,
id = post.id,
reaction = like
)
)
}
}
}

View File

@ -20,16 +20,14 @@ import dev.usbharu.hideout.activitypub.domain.model.Follow
import dev.usbharu.hideout.activitypub.domain.model.Reject
import dev.usbharu.hideout.application.config.ApplicationConfig
import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.external.job.DeliverRejectJob
import dev.usbharu.hideout.core.external.job.DeliverRejectJobParam
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.owl.producer.api.OwlProducer
import org.springframework.stereotype.Service
@Service
class ApSendRejectServiceImpl(
private val applicationConfig: ApplicationConfig,
private val jobQueueParentService: JobQueueParentService,
private val deliverRejectJob: DeliverRejectJob
private val owlProducer: OwlProducer,
) : ApSendRejectService {
override suspend fun sendRejectFollow(actor: Actor, target: Actor) {
val deliverRejectJobParam = DeliverRejectJobParam(
@ -42,6 +40,6 @@ class ApSendRejectServiceImpl(
actor.id
)
jobQueueParentService.scheduleTypeSafe(deliverRejectJob, deliverRejectJobParam)
owlProducer.publishTask(deliverRejectJobParam)
}
}

View File

@ -21,17 +21,15 @@ import dev.usbharu.hideout.activitypub.domain.model.Follow
import dev.usbharu.hideout.activitypub.domain.model.Undo
import dev.usbharu.hideout.application.config.ApplicationConfig
import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.external.job.DeliverUndoJob
import dev.usbharu.hideout.core.external.job.DeliverUndoJobParam
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.owl.producer.api.OwlProducer
import org.springframework.stereotype.Service
import java.time.Instant
@Service
class APSendUndoServiceImpl(
private val jobQueueParentService: JobQueueParentService,
private val deliverUndoJob: DeliverUndoJob,
private val applicationConfig: ApplicationConfig
private val applicationConfig: ApplicationConfig,
private val owlProducer: OwlProducer,
) : APSendUndoService {
override suspend fun sendUndoFollow(actor: Actor, target: Actor) {
val deliverUndoJobParam = DeliverUndoJobParam(
@ -48,7 +46,7 @@ class APSendUndoServiceImpl(
actor.id
)
jobQueueParentService.scheduleTypeSafe(deliverUndoJob, deliverUndoJobParam)
owlProducer.publishTask(deliverUndoJobParam)
}
override suspend fun sendUndoBlock(actor: Actor, target: Actor) {
@ -67,6 +65,6 @@ class APSendUndoServiceImpl(
actor.id
)
jobQueueParentService.scheduleTypeSafe(deliverUndoJob, deliverUndoJobParam)
owlProducer.publishTask(deliverUndoJobParam)
}
}

View File

@ -19,9 +19,9 @@ package dev.usbharu.hideout.activitypub.service.common
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import dev.usbharu.hideout.activitypub.domain.exception.JsonParseException
import dev.usbharu.hideout.core.external.job.InboxJob
import dev.usbharu.hideout.core.service.job.JobQueueParentService
import dev.usbharu.hideout.core.external.job.InboxTask
import dev.usbharu.httpsignature.common.HttpRequest
import dev.usbharu.owl.producer.api.OwlProducer
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Qualifier
@ -41,7 +41,7 @@ interface APService {
@Service
class APServiceImpl(
@Qualifier("activitypub") private val objectMapper: ObjectMapper,
private val jobQueueParentService: JobQueueParentService
private val owlProducer: OwlProducer,
) : APService {
val logger: Logger = LoggerFactory.getLogger(APServiceImpl::class.java)
@ -90,13 +90,14 @@ class APServiceImpl(
map: Map<String, List<String>>
) {
logger.debug("process activity: {}", type)
jobQueueParentService.schedule(InboxJob) {
props[it.json] = json
props[it.type] = type.name
val writeValueAsString = objectMapper.writeValueAsString(httpRequest)
props[it.httpRequest] = writeValueAsString
props[it.headers] = objectMapper.writeValueAsString(map)
}
owlProducer.publishTask(
InboxTask(
json,
type,
httpRequest,
map
)
)
return
}
}

View File

@ -46,4 +46,4 @@ enum class ActivityType {
Update,
View,
Other
}
}

View File

@ -71,4 +71,4 @@ enum class ActivityVocabulary {
Tombstone,
Video,
Mention,
}
}

View File

@ -72,4 +72,4 @@ enum class ExtendedActivityVocabulary {
Video,
Mention,
Emoji
}
}

View File

@ -18,4 +18,4 @@ package dev.usbharu.hideout.activitypub.service.common
enum class ExtendedVocabulary {
Emoji
}
}

View File

@ -19,6 +19,7 @@ package dev.usbharu.hideout.core.external.job
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.activitypub.domain.model.Accept
import dev.usbharu.owl.common.task.Task
import kjob.core.dsl.ScheduleContext
import kjob.core.job.JobProps
import org.springframework.stereotype.Component
@ -26,8 +27,8 @@ import org.springframework.stereotype.Component
data class DeliverAcceptJobParam(
val accept: Accept,
val inbox: String,
val signer: Long
)
val signer: Long,
) : Task()
@Component
class DeliverAcceptJob(private val objectMapper: ObjectMapper) :

View File

@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.activitypub.domain.model.Block
import dev.usbharu.hideout.activitypub.domain.model.Reject
import dev.usbharu.owl.common.task.Task
import kjob.core.dsl.ScheduleContext
import kjob.core.job.JobProps
import org.springframework.beans.factory.annotation.Qualifier
@ -37,8 +38,8 @@ data class DeliverBlockJobParam(
val signer: Long,
val block: Block,
val reject: Reject,
val inbox: String
)
val inbox: String,
) : Task()
/**
* ブロックアクティビティ配送のジョブ

View File

@ -19,6 +19,7 @@ package dev.usbharu.hideout.core.external.job
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.activitypub.domain.model.Delete
import dev.usbharu.owl.common.task.Task
import kjob.core.dsl.ScheduleContext
import kjob.core.job.JobProps
import org.springframework.beans.factory.annotation.Qualifier
@ -27,8 +28,8 @@ import org.springframework.stereotype.Component
data class DeliverDeleteJobParam(
val delete: Delete,
val inbox: String,
val signer: Long
)
val signer: Long,
) : Task()
@Component
class DeliverDeleteJob(@Qualifier("activitypub") private val objectMapper: ObjectMapper) :

View File

@ -0,0 +1,26 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.external.job
import dev.usbharu.hideout.activitypub.domain.model.Create
import dev.usbharu.owl.common.task.Task
data class DeliverPostTask(
val create: Create,
val inbox: String,
val actor: String,
) : Task()

View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.external.job
import dev.usbharu.owl.common.task.Task
data class DeliverReactionTask(
val actor: String,
val reaction: String,
val inbox: String,
val postUrl: String,
val id: Long,
) : Task()

View File

@ -19,6 +19,7 @@ package dev.usbharu.hideout.core.external.job
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.activitypub.domain.model.Reject
import dev.usbharu.owl.common.task.Task
import kjob.core.dsl.ScheduleContext
import kjob.core.job.JobProps
import org.springframework.beans.factory.annotation.Qualifier
@ -27,8 +28,8 @@ import org.springframework.stereotype.Component
data class DeliverRejectJobParam(
val reject: Reject,
val inbox: String,
val signer: Long
)
val signer: Long,
) : Task()
@Component
class DeliverRejectJob(@Qualifier("activitypub") private val objectMapper: ObjectMapper) :

View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.external.job
import dev.usbharu.hideout.core.domain.model.reaction.Reaction
import dev.usbharu.owl.common.task.Task
data class DeliverRemoveReactionTask(
val actor: String,
val inbox: String,
val id: Long,
val reaction: Reaction,
) : Task()

View File

@ -19,6 +19,7 @@ package dev.usbharu.hideout.core.external.job
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.activitypub.domain.model.Undo
import dev.usbharu.owl.common.task.Task
import kjob.core.dsl.ScheduleContext
import kjob.core.job.JobProps
import org.springframework.beans.factory.annotation.Qualifier
@ -27,8 +28,8 @@ import org.springframework.stereotype.Component
data class DeliverUndoJobParam(
val undo: Undo,
val inbox: String,
val signer: Long
)
val signer: Long,
) : Task()
@Component
class DeliverUndoJob(@Qualifier("activitypub") private val objectMapper: ObjectMapper) :

View File

@ -17,6 +17,7 @@
package dev.usbharu.hideout.core.external.job
import dev.usbharu.hideout.activitypub.service.common.ActivityType
import dev.usbharu.owl.common.task.Task
import kjob.core.Job
import kjob.core.Prop
import kjob.core.dsl.ScheduleContext
@ -32,8 +33,8 @@ abstract class HideoutJob<out T, out R : HideoutJob<T, R>>(name: String) : Job(n
data class ReceiveFollowJobParam(
val actor: String,
val follow: String,
val targetActor: String
)
val targetActor: String,
) : Task()
@Component
object ReceiveFollowJob : HideoutJob<ReceiveFollowJobParam, ReceiveFollowJob>("ReceiveFollowJob") {

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.external.job
import dev.usbharu.hideout.activitypub.service.common.ActivityType
import dev.usbharu.httpsignature.common.HttpRequest
import dev.usbharu.owl.common.task.Task
data class InboxTask(
val json: String,
val type: ActivityType,
val httpRequest: HttpRequest,
val headers: Map<String, List<String>>,
) : Task()

View File

@ -0,0 +1,26 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.external.job
import dev.usbharu.hideout.activitypub.domain.model.Follow
import dev.usbharu.owl.common.task.Task
data class ReceiveFollowTask(
val actor: String,
val follow: Follow,
val targetActor: String,
) : Task()

View File

@ -18,6 +18,7 @@ package dev.usbharu.hideout.core.service.job
import dev.usbharu.hideout.core.external.job.HideoutJob
@Deprecated("use owl")
interface JobProcessor<in T, out R : HideoutJob<@UnsafeVariance T, R>> {
suspend fun process(param: @UnsafeVariance T)
fun job(): R

View File

@ -22,6 +22,7 @@ import kjob.core.dsl.ScheduleContext
import org.springframework.stereotype.Service
@Service
@Deprecated("use owl producer")
interface JobQueueParentService {
fun init(jobDefines: List<Job>)

View File

@ -22,6 +22,7 @@ import dev.usbharu.hideout.core.external.job.HideoutJob as HJ
import kjob.core.dsl.JobContextWithProps as JCWP
import kjob.core.dsl.JobRegisterContext as JRC
@Deprecated("use owl")
@Service
interface JobQueueWorkerService {
fun <T, R : HJ<T, R>> init(

View File

@ -38,7 +38,7 @@ class AccountNotFoundException : ClientException {
) : super(message, cause, enableSuppression, writableStackTrace, response)
fun getTypedResponse(): MastodonApiErrorResponse<NotFoundResponse> =
response
response as MastodonApiErrorResponse<NotFoundResponse>
companion object {
fun ofId(id: Long): AccountNotFoundException = AccountNotFoundException(

View File

@ -40,7 +40,7 @@ class StatusNotFoundException : ClientException {
) : super(message, cause, enableSuppression, writableStackTrace, response)
fun getTypedResponse(): MastodonApiErrorResponse<NotFoundResponse> =
response
response as MastodonApiErrorResponse<NotFoundResponse>
companion object {
fun ofId(id: Long): StatusNotFoundException = StatusNotFoundException(

View File

@ -16,9 +16,9 @@
package dev.usbharu.hideout.mastodon.interfaces.api.status
import Status
import com.fasterxml.jackson.annotation.JsonProperty
import dev.usbharu.hideout.core.domain.model.post.Visibility
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
import dev.usbharu.hideout.domain.mastodon.model.generated.StatusesRequestPoll
import dev.usbharu.hideout.mastodon.interfaces.api.status.StatusesRequest.Visibility.*

View File

@ -55,11 +55,9 @@ class APReactionServiceImplTest {
onBlocking { findById(eq(user.id)) }.doReturn(user)
}
val apReactionServiceImpl = APReactionServiceImpl(
jobQueueParentService = jobQueueParentService,
actorRepository = actorRepository,
followerQueryService = followerQueryService,
postRepository = postQueryService,
objectMapper = objectMapper
)
apReactionServiceImpl.reaction(

View File

@ -13,4 +13,6 @@ dependencyResolutionManagement {
from(files("../libs.versions.toml"))
}
}
}
}
includeBuild("../hideout-core")

View File

@ -4,7 +4,7 @@ kotlin = "1.9.23"
ktor = "2.3.9"
exposed = "0.49.0"
javacv-ffmpeg = "6.1.1-1.5.10"
detekt = "1.23.5"
detekt = "1.23.6"
coroutines = "1.8.0"
swagger = "2.2.6"
serialization = "1.6.3"