move subscribeToBus in configureGameListener function, and use it on test

This commit is contained in:
2025-04-14 23:40:11 +02:00
parent d5d6a48df3
commit 2fb4c778fd
10 changed files with 104 additions and 37 deletions
@@ -19,8 +19,6 @@ import redis.clients.jedis.UnifiedJedis
*/
class GameStateRepositoryInRedis(
eventStore: GameEventStore,
projectionBus: GameProjectionBus,
eventBus: GameEventBus,
jedis: UnifiedJedis,
snapshotConfig: SnapshotConfig = SnapshotConfig(),
) : GameStateRepository {
@@ -36,7 +34,10 @@ class GameStateRepositoryInRedis(
jedis = jedis,
)
init {
fun subscribeToBus(
projectionBus: GameProjectionBus,
eventBus: GameEventBus,
) {
// On new event was received, build snapshot and publish it to the projection bus
eventBus.subscribe { event ->
withLoggingContext("event" to event.toString()) {