Pil0tXia commented on code in PR #4469:
URL: https://github.com/apache/eventmesh/pull/4469#discussion_r1343505106


##########
eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java:
##########
@@ -31,28 +30,57 @@
 
 
 import lombok.extern.slf4j.Slf4j;
+public class ReplacedWithLambda implements SubClientImpl {
+
+    public ReplacedWithLambda() {
+        super("localhost", 10000, MessageUtils.generateSubServer());
+    }
+
+    @Override
+    public void handle(Package msg, ChannelHandlerContext ctx) {
+        if (msg.getHeader().getCommand() == 
Command.BROADCAST_MESSAGE_TO_CLIENT) {
+            if (msg.getBody() instanceof EventMeshMessage) {
+                String body = ((EventMeshMessage) msg.getBody()).getBody();
+                if (log.isInfoEnabled()) {
+                    log.info("receive message -------------------------------" 
+ body);
+                }
+            }
+        }
+    }
+}
+
+
 
-@Slf4j
 public class BroadCastSubClient {
 
     public static void main(String[] args) throws Exception {
-        try (SubClientImpl client = new SubClientImpl("localhost", 10000, 
MessageUtils.generateSubServer())) {
+        try (ReplacedWithLambda client = new ReplacedWithLambda()) {
             client.init();
             client.heartbeat();
             client.justSubscribe(ClientConstants.BROADCAST_TOPIC, 
SubscriptionMode.BROADCASTING, SubscriptionType.ASYNC);
-            client.registerBusiHandler(new ReceiveMsgHook() {
-                @Override
-                public void handle(Package msg, ChannelHandlerContext ctx) {
-                    if (msg.getHeader().getCommand() == 
Command.BROADCAST_MESSAGE_TO_CLIENT) {
-                        if (msg.getBody() instanceof EventMeshMessage) {
-                            String body = ((EventMeshMessage) 
msg.getBody()).getBody();
-                            if (log.isInfoEnabled()) {
-                                log.info("receive message 
-------------------------------" + body);
-                            }
-                        }
-                    }
-                }
-            });
+
+            client.registerBusiHandler(new ReceiveMsgHook());
+            client.handle();
+
         }
     }
 }
+
+            //client.registerBusiHandler(new ReceiveMsgHook() {
+
+               // @Override
+//                public void handle(Package msg, ChannelHandlerContext ctx)-> 
{
+//                    if (msg.getHeader().getCommand() == 
Command.BROADCAST_MESSAGE_TO_CLIENT) {
+//                        if (msg.getBody() instanceof EventMeshMessage) {
+//                            String body = ((EventMeshMessage) 
msg.getBody()).getBody();
+//                            if (log.isInfoEnabled()) {
+//                                log.info("receive message 
-------------------------------"+body);
+//                            }
+//                        }
+//                    }
+//                }
+          //  });
+//
+//        }
+//    }
+//}

Review Comment:
   Unused comments may be removed.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to