From 489a1780d43a8e40b66484f91720143e7d488d59 Mon Sep 17 00:00:00 2001 From: Sanoj Punchihewa Date: Mon, 20 Jan 2025 16:10:14 +0530 Subject: [PATCH] Remove Reliant Continuation State when running Scatter Gather in sequential mode --- .../org/apache/synapse/mediators/v2/ForEachMediatorV2.java | 7 ++++--- .../org/apache/synapse/mediators/v2/ScatterGather.java | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/apache/synapse/mediators/v2/ForEachMediatorV2.java b/modules/core/src/main/java/org/apache/synapse/mediators/v2/ForEachMediatorV2.java index b83e91517c..ef4afa8ef5 100644 --- a/modules/core/src/main/java/org/apache/synapse/mediators/v2/ForEachMediatorV2.java +++ b/modules/core/src/main/java/org/apache/synapse/mediators/v2/ForEachMediatorV2.java @@ -275,9 +275,6 @@ public boolean mediate(MessageContext synCtx, ContinuationState continuationStat } if (result) { - // If the mediation is completed, remove the child continuation state from the stack, so the aggregation - // will continue the mediation from the parent continuation state - ContinuationStackManager.removeReliantContinuationState(synCtx); return aggregateMessages(synCtx, synLog); } return false; @@ -285,6 +282,10 @@ public boolean mediate(MessageContext synCtx, ContinuationState continuationStat private boolean aggregateMessages(MessageContext synCtx, SynapseLog synLog) { + // If the mediation is completed, remove the child continuation state from the stack, so the aggregation + // will continue the mediation from the parent continuation state + ContinuationStackManager.removeReliantContinuationState(synCtx); + ForEachAggregate aggregate = null; String correlationIdName = EIPConstants.AGGREGATE_CORRELATION + "." + id; diff --git a/modules/core/src/main/java/org/apache/synapse/mediators/v2/ScatterGather.java b/modules/core/src/main/java/org/apache/synapse/mediators/v2/ScatterGather.java index 9992ff7e10..21c0bf9be7 100644 --- a/modules/core/src/main/java/org/apache/synapse/mediators/v2/ScatterGather.java +++ b/modules/core/src/main/java/org/apache/synapse/mediators/v2/ScatterGather.java @@ -286,9 +286,6 @@ public boolean mediate(MessageContext synCtx, ContinuationState continuationStat } } if (result) { - // If the mediation is completed, remove the child continuation state from the stack, so the aggregation - // will continue the mediation from the parent continuation state - ContinuationStackManager.removeReliantContinuationState(synCtx); return aggregateMessages(synCtx, synLog); } return false; @@ -296,6 +293,10 @@ public boolean mediate(MessageContext synCtx, ContinuationState continuationStat private boolean aggregateMessages(MessageContext synCtx, SynapseLog synLog) { + // If the mediation is completed, remove the child continuation state from the stack, so the aggregation + // will continue the mediation from the parent continuation state + ContinuationStackManager.removeReliantContinuationState(synCtx); + Aggregate aggregate = null; String correlationIdName = EIPConstants.AGGREGATE_CORRELATION + "." + id;