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 {
public static Handler traceable (Handler 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.
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 {
public static Handler traceable (Handler 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.