fix and improve ProjectionSnapshotRepositoryInRedis

This commit is contained in:
2025-03-26 03:36:49 +01:00
parent 22792a0427
commit 442379dc49
18 changed files with 283 additions and 151 deletions

View File

@@ -1,21 +1,21 @@
package eventDemo.libs.bus
import io.github.oshai.kotlinlogging.withLoggingContext
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.coroutineScope
class BusInMemory<E> : Bus<E> {
private val subscribers: MutableList<Pair<Int, suspend (E) -> Unit>> = mutableListOf()
override fun publish(item: E) {
subscribers
.sortedByDescending { (priority, _) -> priority }
.forEach { (_, block) ->
runBlocking {
withLoggingContext("busItem" to item.toString()) {
override suspend fun publish(item: E) {
withLoggingContext("busItem" to item.toString()) {
subscribers
.sortedByDescending { (priority, _) -> priority }
.forEach { (_, block) ->
coroutineScope {
block(item)
}
}
}
}
}
override fun subscribe(