From 3134d93f0823ec6ec7479bec5553de2efe9f89b2 Mon Sep 17 00:00:00 2001 From: xb205 <62425964+devxb@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:49:37 +0900 Subject: [PATCH] fix: Choreographys successWith published when receive other event (#118) * fix: Choreography's successWith published when receive orchestrate event * docs: Netx version 0.3.7 to 0.3.8 --- README.md | 2 +- gradle.properties | 2 +- .../kotlin/org/rooftop/netx/api/TransactionCommitEvent.kt | 4 ++-- .../kotlin/org/rooftop/netx/api/TransactionJoinEvent.kt | 2 +- .../kotlin/org/rooftop/netx/api/TransactionRollbackEvent.kt | 4 ++-- .../kotlin/org/rooftop/netx/api/TransactionStartEvent.kt | 4 ++-- .../kotlin/org/rooftop/netx/engine/MonoDispatchFunction.kt | 6 +++++- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d6e57c3..81ae77b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@
-![version 0.3.7](https://img.shields.io/badge/version-0.3.7-black?labelColor=black&style=flat-square) ![jdk 17](https://img.shields.io/badge/minimum_jdk-17-orange?labelColor=black&style=flat-square) ![load-test](https://img.shields.io/badge/load%20test%2010%2C000%2C000-success-brightgreen?labelColor=black&style=flat-square) +![version 0.3.8](https://img.shields.io/badge/version-0.3.8-black?labelColor=black&style=flat-square) ![jdk 17](https://img.shields.io/badge/minimum_jdk-17-orange?labelColor=black&style=flat-square) ![load-test](https://img.shields.io/badge/load%20test%2010%2C000%2C000-success-brightgreen?labelColor=black&style=flat-square) ![redis--stream](https://img.shields.io/badge/-redis--stream-da2020?style=flat-square&logo=Redis&logoColor=white) Redis-Stream을 지원하는 Saga frame work 입니다. diff --git a/gradle.properties b/gradle.properties index 3d395ef..5320a89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ kotlin.code.style=official ### Project ### group=org.rooftop.netx -version=0.3.2 +version=0.3.8 compatibility=17 ### Sonarcloud ### diff --git a/src/main/kotlin/org/rooftop/netx/api/TransactionCommitEvent.kt b/src/main/kotlin/org/rooftop/netx/api/TransactionCommitEvent.kt index 87b33a2..ba47177 100644 --- a/src/main/kotlin/org/rooftop/netx/api/TransactionCommitEvent.kt +++ b/src/main/kotlin/org/rooftop/netx/api/TransactionCommitEvent.kt @@ -8,6 +8,6 @@ class TransactionCommitEvent internal constructor( codec: Codec, ): TransactionEvent(transactionId, nodeName, group, event, codec) { - override fun copy(): TransactionEvent = - TransactionJoinEvent(transactionId, nodeName, group, event, codec) + override fun copy(): TransactionCommitEvent = + TransactionCommitEvent(transactionId, nodeName, group, event, codec) } diff --git a/src/main/kotlin/org/rooftop/netx/api/TransactionJoinEvent.kt b/src/main/kotlin/org/rooftop/netx/api/TransactionJoinEvent.kt index b8753f1..9a31120 100644 --- a/src/main/kotlin/org/rooftop/netx/api/TransactionJoinEvent.kt +++ b/src/main/kotlin/org/rooftop/netx/api/TransactionJoinEvent.kt @@ -8,6 +8,6 @@ class TransactionJoinEvent internal constructor( codec: Codec, ) : TransactionEvent(transactionId, nodeName, group, event, codec) { - override fun copy(): TransactionEvent = + override fun copy(): TransactionJoinEvent = TransactionJoinEvent(transactionId, nodeName, group, event, codec) } diff --git a/src/main/kotlin/org/rooftop/netx/api/TransactionRollbackEvent.kt b/src/main/kotlin/org/rooftop/netx/api/TransactionRollbackEvent.kt index 21f2629..ced0e88 100644 --- a/src/main/kotlin/org/rooftop/netx/api/TransactionRollbackEvent.kt +++ b/src/main/kotlin/org/rooftop/netx/api/TransactionRollbackEvent.kt @@ -9,6 +9,6 @@ class TransactionRollbackEvent internal constructor( codec: Codec, ) : TransactionEvent(transactionId, nodeName, group, event, codec) { - override fun copy(): TransactionEvent = - TransactionJoinEvent(transactionId, nodeName, group, event, codec) + override fun copy(): TransactionRollbackEvent = + TransactionRollbackEvent(transactionId, nodeName, group, event, cause, codec) } diff --git a/src/main/kotlin/org/rooftop/netx/api/TransactionStartEvent.kt b/src/main/kotlin/org/rooftop/netx/api/TransactionStartEvent.kt index 4348715..8e1831d 100644 --- a/src/main/kotlin/org/rooftop/netx/api/TransactionStartEvent.kt +++ b/src/main/kotlin/org/rooftop/netx/api/TransactionStartEvent.kt @@ -8,6 +8,6 @@ class TransactionStartEvent internal constructor( codec: Codec, ) : TransactionEvent(transactionId, nodeName, group, event, codec) { - override fun copy(): TransactionEvent = - TransactionJoinEvent(transactionId, nodeName, group, event, codec) + override fun copy(): TransactionStartEvent = + TransactionStartEvent(transactionId, nodeName, group, event, codec) } diff --git a/src/main/kotlin/org/rooftop/netx/engine/MonoDispatchFunction.kt b/src/main/kotlin/org/rooftop/netx/engine/MonoDispatchFunction.kt index b559cf8..2fefc4f 100644 --- a/src/main/kotlin/org/rooftop/netx/engine/MonoDispatchFunction.kt +++ b/src/main/kotlin/org/rooftop/netx/engine/MonoDispatchFunction.kt @@ -36,7 +36,11 @@ internal class MonoDispatchFunction( .flatMap { function.call(handler, transactionEvent) } .info("Call Mono TransactionHandler \"${name()}\" with transactionId \"${transactionEvent.transactionId}\"") .switchIfEmpty(`continue`) - .doOnNext { publishNextTransaction(transactionEvent) } + .doOnNext { + if (isProcessable(transactionEvent)) { + publishNextTransaction(transactionEvent) + } + } .onErrorResume { if (isNoRollbackFor(it)) { return@onErrorResume noRollbackFor