create GameListRepositoryInRedis

This commit is contained in:
2025-04-14 23:40:11 +02:00
parent 2fb4c778fd
commit 70d596acf0
4 changed files with 79 additions and 14 deletions
@@ -10,6 +10,7 @@ import eventDemo.configuration.route.declareHttpGameRoute
import eventDemo.configuration.route.declareWebSocketsGameRoute
import io.ktor.server.application.Application
import org.koin.ktor.ext.get
import org.koin.ktor.ext.getKoin
fun Application.configure() {
configureKoin()
@@ -24,5 +25,5 @@ fun Application.configure() {
configureHttpRouting()
declareHttpGameRoute()
configureGameListener()
getKoin().configureGameListener()
}
@@ -4,7 +4,7 @@ import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
import eventDemo.adapter.infrastructureLayer.event.GameEventBusInMemory
import eventDemo.adapter.infrastructureLayer.event.GameEventStoreInPostgresql
import eventDemo.adapter.infrastructureLayer.event.projection.GameListRepositoryInMemory
import eventDemo.adapter.infrastructureLayer.event.projection.GameListRepositoryInRedis
import eventDemo.adapter.infrastructureLayer.event.projection.GameProjectionBusInMemory
import eventDemo.adapter.infrastructureLayer.event.projection.GameStateRepositoryInRedis
import eventDemo.business.event.GameEventBus
@@ -21,7 +21,7 @@ import redis.clients.jedis.UnifiedJedis
import javax.sql.DataSource
fun Module.configureDIInfrastructure(config: Configuration) {
factory {
single {
JedisPooled(config.redisUrl)
} bind UnifiedJedis::class
@@ -47,6 +47,6 @@ fun Module.configureDIInfrastructure(config: Configuration) {
} bind GameStateRepository::class
single {
GameListRepositoryInMemory(get(), get(), get(), snapshotConfig = SnapshotConfig())
GameListRepositoryInRedis(get(), get(), snapshotConfig = SnapshotConfig())
} bind GameListRepository::class
}