com.cultureamp.eventsourcing.AsyncEventProcessorMonitor.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kestrel Show documentation
Show all versions of kestrel Show documentation
Kotlin Framework for running event-sourced services
The newest version!
package com.cultureamp.eventsourcing
class AsyncEventProcessorMonitor(
private val asyncEventProcessors: List>,
private val metrics: (Lag) -> Unit,
) {
fun run() {
val lags = asyncEventProcessors.map {
val bookmarkSequence = it.bookmarkStore.bookmarkFor(it.bookmarkName).sequence
val lastSequence = it.eventsSequenceStats.lastSequence(it.sequencedEventProcessor.domainEventClasses())
Lag(
name = it.bookmarkName,
bookmarkSequence = bookmarkSequence,
lastSequence = lastSequence,
)
}
lags.forEach {
metrics(it)
}
}
}
data class Lag(val name: String, val bookmarkSequence: Long, val lastSequence: Long) {
val lag: Long = lastSequence - bookmarkSequence
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy