You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/12/10 02:33:44 UTC

[servicecomb-pack] 11/13: SCB-1627 Send compensation ack event only when Alpha with Akka Actor

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git

commit b44e17d07985b9fd69f3aa9e42ab95bc37b57f7e
Author: Lei Zhang <zh...@apache.org>
AuthorDate: Wed Dec 4 11:12:26 2019 +0800

    SCB-1627 Send compensation ack event only when Alpha with Akka Actor
---
 .../servicecomb/pack/omega/transaction/CallbackContext.java  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/omega/omega-transaction/src/main/java/org/apache/servicecomb/pack/omega/transaction/CallbackContext.java b/omega/omega-transaction/src/main/java/org/apache/servicecomb/pack/omega/transaction/CallbackContext.java
index c069ac9..94a7111 100644
--- a/omega/omega-transaction/src/main/java/org/apache/servicecomb/pack/omega/transaction/CallbackContext.java
+++ b/omega/omega-transaction/src/main/java/org/apache/servicecomb/pack/omega/transaction/CallbackContext.java
@@ -51,10 +51,18 @@ public class CallbackContext {
       omegaContext.setGlobalTxId(globalTxId);
       omegaContext.setLocalTxId(localTxId);
       contextInternal.callbackMethod.invoke(contextInternal.target, payloads);
+      if (omegaContext.getAlphaMetas().isAkkaEnabled()) {
+        sender.send(
+            new TxCompensateAckSucceedEvent(omegaContext.globalTxId(), omegaContext.localTxId(),
+                omegaContext.globalTxId()));
+      }
       LOG.info("Callback transaction with global tx id [{}], local tx id [{}]", globalTxId, localTxId);
-      sender.send(new TxCompensateAckSucceedEvent(omegaContext.globalTxId(),omegaContext.localTxId(),omegaContext.globalTxId()));
     } catch (IllegalAccessException | InvocationTargetException e) {
-      sender.send(new TxCompensateAckFailedEvent(omegaContext.globalTxId(),omegaContext.localTxId(),omegaContext.globalTxId()));
+      if (omegaContext.getAlphaMetas().isAkkaEnabled()) {
+        sender.send(
+            new TxCompensateAckFailedEvent(omegaContext.globalTxId(), omegaContext.localTxId(),
+                omegaContext.globalTxId()));
+      }
       LOG.error(
           "Pre-checking for callback method " + contextInternal.callbackMethod.toString()
               + " was somehow skipped, did you forget to configure callback method checking on service startup?",