Skip to content

Commit

Permalink
Merge pull request #2330 from SanojPunchihewa/bug-fixes
Browse files Browse the repository at this point in the history
Update error message for aggregation issues in Scatter Gather
  • Loading branch information
SanojPunchihewa authored Feb 13, 2025
2 parents 8454bc5 + fd500ad commit 45cc940
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,11 @@ public boolean mediate(MessageContext synCtx, ContinuationState continuationStat
((Mediator) mediator).reportCloseStatistics(synCtx, null);
}
}
// If this a continue without aggregation scenario, return false to end the mediation
if (continueWithoutAggregation) {
return false;
}
if (readyToAggregate) {
return aggregateMessages(synCtx, synLog);
if (!continueWithoutAggregation) {
return aggregateMessages(synCtx, synLog);
}
return false;
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,12 @@ private void setJSONResultToVariable(JsonArray variable, Aggregate aggregate) {

for (MessageContext synCtx : aggregate.getMessages()) {
Object evaluatedResult = aggregationExpression.objectValueOf(synCtx);
variable.add((JsonElement) evaluatedResult);
if (evaluatedResult instanceof JsonElement) {
variable.add((JsonElement) evaluatedResult);
} else {
handleException(aggregate, "Aggregation expression " + aggregationExpression.toString() +
" did not return a valid JSON element", null, synCtx);
}
}
}

Expand Down

0 comments on commit 45cc940

Please sign in to comment.