From b9224c55447cfa2703f2713825bc02e4c58905c5 Mon Sep 17 00:00:00 2001 From: Arunan Sugunakumar Date: Tue, 3 Dec 2024 11:44:54 +0530 Subject: [PATCH 1/5] Improve call mediator target to support variable --- .../config/xml/CallMediatorFactory.java | 9 ++++++- .../synapse/mediators/eip/EIPUtils.java | 4 +++ .../mediators/elementary/EnrichMediator.java | 2 ++ .../synapse/mediators/elementary/Target.java | 26 +++++++++++++++++++ .../synapse/util/CallMediatorEnrichUtil.java | 18 +++++++++++++ 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/synapse/config/xml/CallMediatorFactory.java b/modules/core/src/main/java/org/apache/synapse/config/xml/CallMediatorFactory.java index 6b444e750d..3714539642 100644 --- a/modules/core/src/main/java/org/apache/synapse/config/xml/CallMediatorFactory.java +++ b/modules/core/src/main/java/org/apache/synapse/config/xml/CallMediatorFactory.java @@ -237,8 +237,15 @@ private void populateTarget(CallMediator callMediator, Target target, OMElement } } else if (target.getTargetType() == EnrichMediator.BODY) { callMediator.setTargetAvailable(false); + } else if (target.getTargetType() == EnrichMediator.VARIABLE) { + String variableName = sourceEle.getText(); + if (variableName != null) { + target.setVariable(variableName); + callMediator.setTargetAvailable(true); + } else { + handleException("Variable name is required for VARIABLE type"); + } } - } public QName getTagQName() { diff --git a/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java b/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java index 09b76b80d5..f8b6b6f9f5 100644 --- a/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java +++ b/modules/core/src/main/java/org/apache/synapse/mediators/eip/EIPUtils.java @@ -434,4 +434,8 @@ public Set