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


##########
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:
   From my understanding MDC is managed per-thread (see 
https://logback.qos.ch/manual/mdc.html#AdvancedUse) so different requests will 
be served by different threads but I may be misleading here



-- 
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