mirror of https://github.com/usbharu/Hideout.git
ジョブキューとタイムライン構築に使うDBを選択できるように
This commit is contained in:
parent
8e217c16ec
commit
5fadd58079
|
@ -4,10 +4,12 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Timeline
|
||||||
import dev.usbharu.hideout.service.core.IdGenerateService
|
import dev.usbharu.hideout.service.core.IdGenerateService
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
|
||||||
import org.springframework.stereotype.Repository
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
@Suppress("InjectDispatcher")
|
@Suppress("InjectDispatcher")
|
||||||
|
@ConditionalOnProperty("hideout.use-mongodb", havingValue = "", matchIfMissing = false)
|
||||||
class MongoTimelineRepositoryWrapper(
|
class MongoTimelineRepositoryWrapper(
|
||||||
private val mongoTimelineRepository: MongoTimelineRepository,
|
private val mongoTimelineRepository: MongoTimelineRepository,
|
||||||
private val idGenerateService: IdGenerateService
|
private val idGenerateService: IdGenerateService
|
||||||
|
|
|
@ -10,7 +10,7 @@ import dev.usbharu.hideout.domain.model.job.HideoutJob as HJ
|
||||||
import kjob.core.dsl.JobContextWithProps as JCWP
|
import kjob.core.dsl.JobContextWithProps as JCWP
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ConditionalOnProperty(name = ["hideout.job-queue.type"], havingValue = "nosql")
|
@ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "", matchIfMissing = false)
|
||||||
class KJobMongoJobQueueWorkerService : JobQueueWorkerService {
|
class KJobMongoJobQueueWorkerService : JobQueueWorkerService {
|
||||||
val kjob by lazy {
|
val kjob by lazy {
|
||||||
kjob(Mongo) {
|
kjob(Mongo) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ConditionalOnProperty(name = ["hideout.job-queue.type"], havingValue = "nosql")
|
@ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "", matchIfMissing = false)
|
||||||
class KjobMongoJobQueueParentService : JobQueueParentService {
|
class KjobMongoJobQueueParentService : JobQueueParentService {
|
||||||
private val kjob = kjob(Mongo) {
|
private val kjob = kjob(Mongo) {
|
||||||
connectionString = "mongodb://localhost"
|
connectionString = "mongodb://localhost"
|
||||||
|
|
|
@ -3,12 +3,14 @@ package dev.usbharu.hideout.service.post
|
||||||
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
|
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Timeline
|
import dev.usbharu.hideout.domain.model.hideout.entity.Timeline
|
||||||
import dev.usbharu.hideout.query.mastodon.StatusQueryService
|
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.MongoTemplate
|
||||||
import org.springframework.data.mongodb.core.query.Criteria
|
import org.springframework.data.mongodb.core.query.Criteria
|
||||||
import org.springframework.data.mongodb.core.query.Query
|
import org.springframework.data.mongodb.core.query.Query
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ConditionalOnProperty("hideout.use-mongodb", havingValue = "", matchIfMissing = false)
|
||||||
class MongoGenerateTimelineService(
|
class MongoGenerateTimelineService(
|
||||||
private val statusQueryService: StatusQueryService,
|
private val statusQueryService: StatusQueryService,
|
||||||
private val mongoTemplate: MongoTemplate
|
private val mongoTemplate: MongoTemplate
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
hideout:
|
hideout:
|
||||||
url: "https://test-hideout.usbharu.dev"
|
url: "https://test-hideout.usbharu.dev"
|
||||||
job-queue:
|
use-mongodb: true
|
||||||
type: "nosql"
|
|
||||||
security:
|
security:
|
||||||
jwt:
|
jwt:
|
||||||
generate: true
|
generate: true
|
||||||
|
|
Loading…
Reference in New Issue