re enable Redis

This commit is contained in:
2025-04-12 22:57:47 +02:00
parent 19c39678cf
commit d394fca3f9
5 changed files with 17 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
package eventDemo.configuration.business
import eventDemo.adapter.infrastructureLayer.event.projection.GameListRepositoryInMemory
import eventDemo.adapter.infrastructureLayer.event.projection.GameStateRepositoryInMemory
import eventDemo.adapter.infrastructureLayer.event.projection.GameListRepositoryInRedis
import eventDemo.adapter.infrastructureLayer.event.projection.GameStateRepositoryInRedis
import eventDemo.business.command.GameCommandHandler
import eventDemo.business.event.projection.projectionListener.ReactionListener
import org.koin.core.Koin
@@ -10,10 +10,10 @@ fun Koin.configureGameListener() {
get<GameCommandHandler>()
.subscribeToBus(get())
get<GameStateRepositoryInMemory>()
get<GameStateRepositoryInRedis>()
.subscribeToBus(get(), get())
get<GameListRepositoryInMemory>()
get<GameListRepositoryInRedis>()
.subscribeToBus(get(), get())
get<ReactionListener>()

View File

@@ -5,9 +5,9 @@ import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
import eventDemo.adapter.infrastructureLayer.event.GameEventBusInRabbinMQ
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.GameStateRepositoryInMemory
import eventDemo.adapter.infrastructureLayer.event.projection.GameStateRepositoryInRedis
import eventDemo.business.event.GameEventBus
import eventDemo.business.event.GameEventStore
import eventDemo.business.event.projection.GameProjectionBus
@@ -19,10 +19,16 @@ import org.koin.core.module.dsl.singleOf
import org.koin.core.scope.Scope
import org.koin.core.scope.ScopeCallback
import org.koin.dsl.bind
import redis.clients.jedis.JedisPooled
import redis.clients.jedis.UnifiedJedis
import javax.sql.DataSource
fun Module.configureDIInfrastructure(config: Configuration) {
// Postgresql config
single {
JedisPooled(config.redisUrl)
} bind UnifiedJedis::class
single {
HikariConfig()
.apply {
@@ -59,10 +65,10 @@ fun Module.configureDIInfrastructure(config: Configuration) {
singleOf(::GameProjectionBusInMemory) bind GameProjectionBus::class
single {
GameStateRepositoryInMemory(get(), snapshotConfig = SnapshotConfig())
GameStateRepositoryInRedis(get(), get(), snapshotConfig = SnapshotConfig())
} bind GameStateRepository::class
single {
GameListRepositoryInMemory(get(), snapshotConfig = SnapshotConfig())
GameListRepositoryInRedis(get(), get(), snapshotConfig = SnapshotConfig())
} bind GameListRepository::class
}