Skip to content

Commit

Permalink
feat: add checkpoint to SnapshotQueryHandler (#955)
Browse files Browse the repository at this point in the history
* feat: add checkpoint to `SnapshotQueryHandler`
  • Loading branch information
Ahoo-Wang authored Oct 31, 2024
1 parent 237c50c commit 9a95e93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kotlin.code.style=official
ksp.incremental=true
ksp.incremental.log=true
group=me.ahoo.wow
version=3.14.1
version=3.14.2
description=A Modern Reactive CQRS Architecture Microservice development framework based on DDD and EventSourcing.
website=https://github.com/Ahoo-Wang/Wow
issues=https://github.com/Ahoo-Wang/Wow/issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import me.ahoo.wow.filter.ErrorHandler
import me.ahoo.wow.filter.FilterChain
import me.ahoo.wow.filter.Handler
import me.ahoo.wow.filter.LogErrorHandler
import me.ahoo.wow.modeling.toStringWithAlias
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono

Expand All @@ -36,6 +37,7 @@ interface SnapshotQueryHandler : Handler<SnapshotQueryContext<*, *, *>> {
queryType = QueryType.SINGLE
).setQuery(singleQuery)
return handle(context)
.checkpoint("Single ${namedAggregate.toStringWithAlias()} [SnapshotQueryHandler]")
.then(
Mono.defer {
context.getRequiredResult()
Expand All @@ -49,6 +51,7 @@ interface SnapshotQueryHandler : Handler<SnapshotQueryContext<*, *, *>> {
queryType = QueryType.DYNAMIC_SINGLE
).setQuery(singleQuery)
return handle(context)
.checkpoint("DynamicSingle ${namedAggregate.toStringWithAlias()} [SnapshotQueryHandler]")
.then(
Mono.defer {
context.getRequiredResult()
Expand All @@ -62,6 +65,7 @@ interface SnapshotQueryHandler : Handler<SnapshotQueryContext<*, *, *>> {
queryType = QueryType.LIST
).setQuery(query)
return handle(context)
.checkpoint("List ${namedAggregate.toStringWithAlias()} [SnapshotQueryHandler]")
.thenMany(
Flux.defer {
context.getRequiredResult()
Expand All @@ -75,6 +79,7 @@ interface SnapshotQueryHandler : Handler<SnapshotQueryContext<*, *, *>> {
queryType = QueryType.DYNAMIC_LIST
).setQuery(query)
return handle(context)
.checkpoint("DynamicList ${namedAggregate.toStringWithAlias()} [SnapshotQueryHandler]")
.thenMany(
Flux.defer {
context.getRequiredResult()
Expand All @@ -91,6 +96,7 @@ interface SnapshotQueryHandler : Handler<SnapshotQueryContext<*, *, *>> {
queryType = QueryType.PAGED
).setQuery(pagedQuery)
return handle(context)
.checkpoint("Paged ${namedAggregate.toStringWithAlias()} [SnapshotQueryHandler]")
.then(
Mono.defer {
context.getRequiredResult()
Expand All @@ -107,6 +113,7 @@ interface SnapshotQueryHandler : Handler<SnapshotQueryContext<*, *, *>> {
queryType = QueryType.DYNAMIC_PAGED
).setQuery(pagedQuery)
return handle(context)
.checkpoint("DynamicPaged ${namedAggregate.toStringWithAlias()} [SnapshotQueryHandler]")
.then(
Mono.defer {
context.getRequiredResult()
Expand All @@ -117,6 +124,7 @@ interface SnapshotQueryHandler : Handler<SnapshotQueryContext<*, *, *>> {
fun count(namedAggregate: NamedAggregate, condition: Condition): Mono<Long> {
val context = CountSnapshotQueryContext(namedAggregate).setQuery(condition)
return handle(context)
.checkpoint("Count ${namedAggregate.toStringWithAlias()} [SnapshotQueryHandler]")
.then(
Mono.defer {
context.getRequiredResult()
Expand Down

0 comments on commit 9a95e93

Please sign in to comment.