ジョブキューとタイムライン構築に使うDBを選択できるように

This commit is contained in:
usbharu 2023-10-03 14:38:38 +09:00
parent 8e217c16ec
commit 5fadd58079
5 changed files with 7 additions and 4 deletions

View File

@ -4,10 +4,12 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Timeline
import dev.usbharu.hideout.service.core.IdGenerateService
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.stereotype.Repository
@Repository
@Suppress("InjectDispatcher")
@ConditionalOnProperty("hideout.use-mongodb", havingValue = "", matchIfMissing = false)
class MongoTimelineRepositoryWrapper(
private val mongoTimelineRepository: MongoTimelineRepository,
private val idGenerateService: IdGenerateService

View File

@ -10,7 +10,7 @@ import dev.usbharu.hideout.domain.model.job.HideoutJob as HJ
import kjob.core.dsl.JobContextWithProps as JCWP
@Service
@ConditionalOnProperty(name = ["hideout.job-queue.type"], havingValue = "nosql")
@ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "", matchIfMissing = false)
class KJobMongoJobQueueWorkerService : JobQueueWorkerService {
val kjob by lazy {
kjob(Mongo) {

View File

@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.stereotype.Service
@Service
@ConditionalOnProperty(name = ["hideout.job-queue.type"], havingValue = "nosql")
@ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "", matchIfMissing = false)
class KjobMongoJobQueueParentService : JobQueueParentService {
private val kjob = kjob(Mongo) {
connectionString = "mongodb://localhost"

View File

@ -3,12 +3,14 @@ package dev.usbharu.hideout.service.post
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
import dev.usbharu.hideout.domain.model.hideout.entity.Timeline
import dev.usbharu.hideout.query.mastodon.StatusQueryService
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.data.mongodb.core.MongoTemplate
import org.springframework.data.mongodb.core.query.Criteria
import org.springframework.data.mongodb.core.query.Query
import org.springframework.stereotype.Service
@Service
@ConditionalOnProperty("hideout.use-mongodb", havingValue = "", matchIfMissing = false)
class MongoGenerateTimelineService(
private val statusQueryService: StatusQueryService,
private val mongoTemplate: MongoTemplate

View File

@ -1,7 +1,6 @@
hideout:
url: "https://test-hideout.usbharu.dev"
job-queue:
type: "nosql"
use-mongodb: true
security:
jwt:
generate: true