feat: use rabbit to projection bus
This commit is contained in:
+4
-4
@@ -3,11 +3,11 @@ package eventDemo.adapter.infrastructureLayer.event.projection
|
||||
import eventDemo.business.entity.GameId
|
||||
import eventDemo.business.event.GameEventBus
|
||||
import eventDemo.business.event.GameEventStore
|
||||
import eventDemo.business.event.projection.GameList
|
||||
import eventDemo.business.event.projection.GameListRepository
|
||||
import eventDemo.business.event.projection.GameProjectionBus
|
||||
import eventDemo.business.event.projection.gameList.GameList
|
||||
import eventDemo.business.event.projection.gameList.GameListRepository
|
||||
import eventDemo.business.event.projection.gameList.apply
|
||||
import eventDemo.business.event.projection.gameState.GameState
|
||||
import eventDemo.business.event.projection.GameState
|
||||
import eventDemo.business.event.projection.apply
|
||||
import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInMemory
|
||||
import eventDemo.libs.event.projection.SnapshotConfig
|
||||
import io.github.oshai.kotlinlogging.withLoggingContext
|
||||
|
||||
+4
-4
@@ -3,11 +3,11 @@ package eventDemo.adapter.infrastructureLayer.event.projection
|
||||
import eventDemo.business.entity.GameId
|
||||
import eventDemo.business.event.GameEventBus
|
||||
import eventDemo.business.event.GameEventStore
|
||||
import eventDemo.business.event.projection.GameList
|
||||
import eventDemo.business.event.projection.GameListRepository
|
||||
import eventDemo.business.event.projection.GameProjectionBus
|
||||
import eventDemo.business.event.projection.gameList.GameList
|
||||
import eventDemo.business.event.projection.gameList.GameListRepository
|
||||
import eventDemo.business.event.projection.gameList.apply
|
||||
import eventDemo.business.event.projection.gameState.GameState
|
||||
import eventDemo.business.event.projection.GameState
|
||||
import eventDemo.business.event.projection.apply
|
||||
import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInRedis
|
||||
import eventDemo.libs.event.projection.SnapshotConfig
|
||||
import io.github.oshai.kotlinlogging.withLoggingContext
|
||||
|
||||
+2
-3
@@ -1,15 +1,14 @@
|
||||
package eventDemo.adapter.infrastructureLayer.event.projection
|
||||
|
||||
import eventDemo.business.entity.GameId
|
||||
import eventDemo.business.event.projection.GameProjection
|
||||
import eventDemo.business.event.projection.GameProjectionBus
|
||||
import eventDemo.libs.bus.Bus
|
||||
import eventDemo.libs.bus.BusInMemory
|
||||
import eventDemo.libs.event.projection.Projection
|
||||
import java.util.UUID
|
||||
|
||||
class GameProjectionBusInMemory :
|
||||
GameProjectionBus,
|
||||
Bus<Projection<GameId>> by BusInMemory(GameProjectionBusInMemory::class),
|
||||
Bus<GameProjection> by BusInMemory(GameProjectionBusInMemory::class),
|
||||
Comparable<GameProjectionBusInMemory> {
|
||||
private val instanceId: UUID = UUID.randomUUID()
|
||||
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package eventDemo.adapter.infrastructureLayer.event.projection
|
||||
|
||||
import com.rabbitmq.client.ConnectionFactory
|
||||
import eventDemo.business.event.projection.GameProjection
|
||||
import eventDemo.business.event.projection.GameProjectionBus
|
||||
import eventDemo.libs.bus.Bus
|
||||
import eventDemo.libs.bus.BusInRabbitMQ
|
||||
import kotlinx.serialization.json.Json
|
||||
import java.util.UUID
|
||||
|
||||
class GameProjectionBusInRabbitMQ(
|
||||
private val connectionFactory: ConnectionFactory,
|
||||
) : GameProjectionBus,
|
||||
Bus<GameProjection> by BusInRabbitMQ(
|
||||
connectionFactory,
|
||||
"GameProjection",
|
||||
{ Json.encodeToString(it) },
|
||||
{ Json.decodeFromString<GameProjection>(it) },
|
||||
),
|
||||
Comparable<GameProjectionBusInRabbitMQ> {
|
||||
private val instanceId: UUID = UUID.randomUUID()
|
||||
|
||||
override fun compareTo(other: GameProjectionBusInRabbitMQ): Int =
|
||||
compareValues(instanceId, other.instanceId)
|
||||
}
|
||||
+3
-3
@@ -5,9 +5,9 @@ import eventDemo.business.event.GameEventBus
|
||||
import eventDemo.business.event.GameEventStore
|
||||
import eventDemo.business.event.event.GameEvent
|
||||
import eventDemo.business.event.projection.GameProjectionBus
|
||||
import eventDemo.business.event.projection.gameState.GameState
|
||||
import eventDemo.business.event.projection.gameState.GameStateRepository
|
||||
import eventDemo.business.event.projection.gameState.apply
|
||||
import eventDemo.business.event.projection.GameState
|
||||
import eventDemo.business.event.projection.GameStateRepository
|
||||
import eventDemo.business.event.projection.apply
|
||||
import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInMemory
|
||||
import eventDemo.libs.event.projection.SnapshotConfig
|
||||
import io.github.oshai.kotlinlogging.withLoggingContext
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import eventDemo.business.event.GameEventBus
|
||||
import eventDemo.business.event.GameEventStore
|
||||
import eventDemo.business.event.event.GameEvent
|
||||
import eventDemo.business.event.projection.GameProjectionBus
|
||||
import eventDemo.business.event.projection.gameState.GameState
|
||||
import eventDemo.business.event.projection.gameState.GameStateRepository
|
||||
import eventDemo.business.event.projection.gameState.apply
|
||||
import eventDemo.business.event.projection.GameState
|
||||
import eventDemo.business.event.projection.GameStateRepository
|
||||
import eventDemo.business.event.projection.apply
|
||||
import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInRedis
|
||||
import eventDemo.libs.event.projection.SnapshotConfig
|
||||
import io.github.oshai.kotlinlogging.withLoggingContext
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package eventDemo.adapter.interfaceLayer.query
|
||||
|
||||
import eventDemo.business.event.projection.gameList.GameListRepository
|
||||
import eventDemo.business.event.projection.GameListRepository
|
||||
import io.ktor.resources.Resource
|
||||
import io.ktor.server.application.call
|
||||
import io.ktor.server.auth.authenticate
|
||||
import io.ktor.server.resources.get
|
||||
import io.ktor.server.response.respond
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package eventDemo.adapter.interfaceLayer.query
|
||||
|
||||
import eventDemo.business.entity.GameId
|
||||
import eventDemo.business.event.projection.gameState.GameStateRepository
|
||||
import eventDemo.business.event.projection.GameStateRepository
|
||||
import eventDemo.configuration.serializer.GameIdSerializer
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.resources.Resource
|
||||
import io.ktor.server.application.call
|
||||
import io.ktor.server.auth.authenticate
|
||||
import io.ktor.server.resources.get
|
||||
import io.ktor.server.response.respond
|
||||
|
||||
Reference in New Issue
Block a user