remove projectionsBuilders method
This commit is contained in:
@@ -7,8 +7,6 @@ import eventDemo.libs.event.Event
|
|||||||
* A stream to publish and read the played card event.
|
* A stream to publish and read the played card event.
|
||||||
*/
|
*/
|
||||||
interface EventHandler<E : Event<ID>, ID : AggregateId> {
|
interface EventHandler<E : Event<ID>, ID : AggregateId> {
|
||||||
fun registerProjectionBuilder(builder: (event: E) -> Unit)
|
|
||||||
|
|
||||||
suspend fun handle(
|
suspend fun handle(
|
||||||
aggregateId: ID,
|
aggregateId: ID,
|
||||||
buildEvent: (version: Int) -> E,
|
buildEvent: (version: Int) -> E,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import eventDemo.business.event.event.GameEvent
|
|||||||
import eventDemo.libs.event.VersionBuilder
|
import eventDemo.libs.event.VersionBuilder
|
||||||
import io.github.oshai.kotlinlogging.withLoggingContext
|
import io.github.oshai.kotlinlogging.withLoggingContext
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue
|
|
||||||
import java.util.concurrent.locks.ReentrantLock
|
import java.util.concurrent.locks.ReentrantLock
|
||||||
import kotlin.concurrent.withLock
|
import kotlin.concurrent.withLock
|
||||||
|
|
||||||
@@ -17,13 +16,8 @@ class GameEventHandler(
|
|||||||
private val eventStore: GameEventStore,
|
private val eventStore: GameEventStore,
|
||||||
private val versionBuilder: VersionBuilder,
|
private val versionBuilder: VersionBuilder,
|
||||||
) : EventHandler<GameEvent, GameId> {
|
) : EventHandler<GameEvent, GameId> {
|
||||||
private val projectionsBuilders: ConcurrentLinkedQueue<(GameEvent) -> Unit> = ConcurrentLinkedQueue()
|
|
||||||
private val locks: ConcurrentHashMap<GameId, ReentrantLock> = ConcurrentHashMap()
|
private val locks: ConcurrentHashMap<GameId, ReentrantLock> = ConcurrentHashMap()
|
||||||
|
|
||||||
override fun registerProjectionBuilder(builder: (event: GameEvent) -> Unit) {
|
|
||||||
projectionsBuilders.add(builder)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build Event then send it to the event store and bus.
|
* Build Event then send it to the event store and bus.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user