You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by Yufei Zhang <af...@gmail.com> on 2020/05/07 20:25:13 UTC

Why AsyncNettyRequestProcessor do not need to call doAfterRpcHook()

Hi RocketMQ developers,

I had some questions regarding rocketmq remoting source code, would
appreciate it so much if you can take a look at it.

in remoting/netty/NettyRemotingAbstract.java I saw we have implemented sync
processor and async processor. But when we are using an async processor, we
didn't call doAfterRpcHooks as sync processors do.

I'm curious about what is the design considerations here and wondering
maybe you can answer my questions. Thanks so much!


Yufei Zhang

if (pair.getObject1() instanceof AsyncNettyRequestProcessor) {
    AsyncNettyRequestProcessor processor =
(AsyncNettyRequestProcessor)pair.getObject1();
    processor.asyncProcessRequest(ctx, cmd, callback);
    // TODO why not have a doAfterRpcHooks here
} else {
    NettyRequestProcessor processor = pair.getObject1();
    RemotingCommand response = processor.processRequest(ctx, cmd);
    doAfterRpcHooks(RemotingHelper.parseChannelRemoteAddr(ctx.channel()),
cmd, response);
    callback.callback(response);
}