gabriel-farache commented on code in PR #4094:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4094#discussion_r2588640553


##########
jbpm/jbpm-flow/src/main/java/org/kie/kogito/process/impl/AbstractProcessInstance.java:
##########
@@ -225,9 +226,35 @@ protected void reconnect() {
         }
         
getProcessRuntime().getProcessInstanceManager().setLock(((MutableProcessInstances<T>)
 process.instances()).lock());
         processInstance.setMetaData(KOGITO_PROCESS_INSTANCE, this);
+
+        restoreProcessInstanceContext();
+
         processInstance.reconnect();
     }
 
+    private void restoreProcessInstanceContext() {
+        Map<String, List<String>> headers = processInstance.getHeaders();
+        if (headers != null && !headers.isEmpty()) {
+            Map<String, String> contextMap = 
convertHeadersToContextMap(headers);
+            if (!contextMap.isEmpty()) {
+                
org.kie.kogito.services.context.ProcessInstanceContext.setContextFromAsync(contextMap);

Review Comment:
   Actually maybe I just need to call `restoreExtensionKeys(contextMap);` in 
the `setContextFromAsync` method, it would lead to the same result as adding 
the MDC current context in the `contextMap`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to