duhenglucky commented on issue #1881: [ISSUE #1879] Prevent blocked by group 
transfer service
URL: https://github.com/apache/rocketmq/pull/1881#issuecomment-610735743
 
 
   > > > Run example `org.apache.rocketmq.example.quickstart.Producer` to send 
a msg.
   > > > for debug, i add a sout here
   > > > ```java
   > > > @Override
   > > > public void asyncProcessRequest(ChannelHandlerContext ctx, 
RemotingCommand request, RemotingResponseCallback responseCallback) throws 
Exception {
   > > >        asyncProcessRequest(ctx, request).thenAcceptAsync(
   > > >                        r -> {
   > > >                                System.out.println(r);
   > > >                                responseCallback.callback(r);
   > > >                        },
   > > >                        this.brokerController.getSendMessageExecutor());
   > > > }
   > > > ```
   > > > 
   > > > 
   > > > debug result:
   > > > 
   > > > 1. 
`org.apache.rocketmq.broker.processor.SendMessageProcessor#handlePutMessageResult`
 is invoked in GroupCommitService thread.
   > > > 
   > > > ```java
   > > > {
   > > >   System.out.println(r);
   > > >   responseCallback.callback(r);
   > > > }
   > > > ```
   > > > 
   > > > 
   > > > is invoked in SendMessageThread_1, and r is null
   > > 
   > > 
   > > r is null just because of the succeed send message response returned to 
the client directly by 
org.apache.rocketmq.broker.processor.AbstractSendMessageProcessor#doResponse in 
org.apache.rocketmq.broker.processor.SendMessageProcessor#handlePutMessageResult
 method and these responses will not be processed by AfterRPCHook, the code 
here is a little confusing
   > 
   > Yes, that's why i apply `thenApplyAsync` method on 
`SendMessageProcessor#handlePutMessageResult`, it returns the real response
   
   yep, actually ctx.writeAndFlush is also a blocking operation, let us polish 
it in your PR.

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


With regards,
Apache Git Services

Reply via email to