This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new 0b5767fc92 build error response when sending MultiMessage fail (#10838)
0b5767fc92 is described below

commit 0b5767fc92dcf569b651dec0152e8f8d14229428
Author: 一个不知名的Java靓仔 <[email protected]>
AuthorDate: Thu Oct 27 11:24:28 2022 +0800

    build error response when sending MultiMessage fail (#10838)
---
 .../dubbo/remoting/transport/netty4/NettyClientHandler.java   | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandler.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandler.java
index 43594be761..63690a8759 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandler.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandler.java
@@ -29,6 +29,7 @@ import io.netty.channel.ChannelDuplexHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelPromise;
 import io.netty.handler.timeout.IdleStateEvent;
+import org.apache.dubbo.remoting.exchange.support.MultiMessage;
 
 import static 
org.apache.dubbo.common.constants.CommonConstants.HEARTBEAT_EVENT;
 
@@ -88,6 +89,7 @@ public class NettyClientHandler extends ChannelDuplexHandler {
         super.write(ctx, msg, promise);
         final NettyChannel channel = 
NettyChannel.getOrAddChannel(ctx.channel(), url, handler);
         final boolean isRequest = msg instanceof Request;
+        final boolean isMultiMessage = msg instanceof MultiMessage;
 
         // We add listeners to make sure our out bound event is correct.
         // If our out bound event has an error (in most cases the encoder 
fails),
@@ -104,6 +106,15 @@ public class NettyClientHandler extends 
ChannelDuplexHandler {
                 Request request = (Request) msg;
                 Response response = buildErrorResponse(request, t);
                 handler.received(channel, response);
+            } else if (t != null && isMultiMessage) {
+                MultiMessage multiMessage = (MultiMessage) msg;
+                for (Object originMessage : multiMessage) {
+                    if (originMessage instanceof Request) {
+                        Request request = (Request) originMessage;
+                        Response response = buildErrorResponse(request, t);
+                        handler.received(channel, response);
+                    }
+                }
             }
         });
     }

Reply via email to