In our project, we using reactive mode to gain high performance in high
concurrency scenarios. But sometimes we had using a few legacy Blocking API.
So we need to using executor's executeBlocking to running these blocking code.
but with this raw vert.x API, blocking code lost the InvocationContext. we need
to using ugly wrapper to passing InvocationContext, traceId, etc , just like
following :
public class TraceUtils <T> {
public static <T> Handler<T> traceable (Handler<T> fromHandler) {
String traceId = MDC.get(MDC.TRACE_ID_KEY);
return T -> {
MDC.put (MDC.TRACE_ID_KEY, traceId);
fromHandler.handle(T);
};
}
}
If servicecomb provide similar executingBlocking API, and passing the
InvocationContext. it would be helpful. we can using InvocationContext the pass
the context variable like traceId.
[ Full content available at:
https://github.com/apache/incubator-servicecomb-java-chassis/issues/940 ]
This message was relayed via gitbox.apache.org for [email protected]