Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy variables to cloned messages and callback messages #2229

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,12 @@ private void handleMessage(String messageID ,MessageContext response,
synapseInMessageContext.setProperty(
(String) key, synapseOutMsgCtx.getProperty((String) key));
}


for (Object key : synapseOutMsgCtx.getVariableKeySet()) {
synapseInMessageContext.setVariable(
(String) key, synapseOutMsgCtx.getVariable((String) key));
}

if(failOver){
//we may required to handle same message for failover cases only other than that
//should treat based on the incoming message
Expand Down Expand Up @@ -615,6 +620,11 @@ private void handleMessage(String messageID ,MessageContext response,
(String) key, synapseOutMsgCtx.getProperty((String) key));
}

for (Object key : synapseOutMsgCtx.getVariableKeySet()) {
synapseInMessageContext.setVariable(
(String) key, synapseOutMsgCtx.getVariable((String) key));
}

if (successfulEndpoint instanceof OAuthConfiguredHTTPEndpoint) {

OAuthConfiguredHTTPEndpoint httpEndpoint = (OAuthConfiguredHTTPEndpoint) successfulEndpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ public static MessageContext cloneMessageContext(MessageContext synCtx, boolean
}
}

// copy all the variables to the newCtx
for (Object o : synCtx.getVariableKeySet()) {
String strkey = (String) o;
Object obj = synCtx.getVariable(strkey);
if (obj instanceof OMElement) {
if (log.isDebugEnabled()) {
log.debug("Deep clone for OMElement");
}
obj = ((OMElement) obj).cloneOMElement();
}
newCtx.setVariable(strkey, obj);
}

// Make deep copy of fault stack so that parent will not be lost it's fault stack
Stack<FaultHandler> faultStack = synCtx.getFaultStack();
if (!faultStack.isEmpty()) {
Expand Down
Loading