liubao68 commented on a change in pull request #2154:
URL:
https://github.com/apache/servicecomb-java-chassis/pull/2154#discussion_r547244883
##########
File path:
transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
##########
@@ -116,12 +118,17 @@ public void invoke(Invocation invocation, AsyncResponse
asyncResp) throws Except
filter.beforeSendRequest(invocation, requestEx);
}
}
+ List<HttpRestClientInvocationHook> httpRestClientInvocationHooks =
+ SPIServiceUtils.getAllService(HttpRestClientInvocationHook.class);
clientRequest.exceptionHandler(e -> {
invocation.getTraceIdLogger()
.error(LOGGER, "Failed to send request, alreadyFailed:{}, local:{},
remote:{}, message={}.",
alreadyFailed, getLocalAddress(), ipPort.getSocketAddress(),
ExceptionUtils.getExceptionMessageWithoutTrace(e));
+ httpRestClientInvocationHooks.forEach(httpServerExceptionHandler -> {
Review comment:
```
public class MyHandler implements Handler {
private static final Logger LOGGER =
LoggerFactory.getLogger(MyHandler.class);
@Override
public void handle(Invocation invocation, AsyncResponse asyncResp) throws
Exception {
LOGGER.info("before");
invocation.next(response -> {
LOGGER.info("after");
});
}
}
```
You can find many Handler implementations in servicecomb-java-chassis
project.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]