You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mx...@apache.org on 2023/09/15 14:09:06 UTC

[eventmesh] branch master updated: [ISSUE #4091]refactor: replace with lambda. use the correct log format. (#4445)

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

mxsm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new ff663e2fe [ISSUE #4091]refactor: replace with lambda. use the correct log format. (#4445)
ff663e2fe is described below

commit ff663e2fed0965f054a04c632dfcb768189fe3e3
Author: Hugo Vittek <ye...@gmail.com>
AuthorDate: Fri Sep 15 22:09:01 2023 +0800

    [ISSUE #4091]refactor: replace with lambda. use the correct log format. (#4445)
---
 .../apache/eventmesh/runtime/demo/SyncSubClient.java   | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/SyncSubClient.java b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/SyncSubClient.java
index 010555a10..1689e6091 100644
--- a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/SyncSubClient.java
+++ b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/SyncSubClient.java
@@ -20,33 +20,27 @@ package org.apache.eventmesh.runtime.demo;
 import org.apache.eventmesh.common.protocol.SubscriptionMode;
 import org.apache.eventmesh.common.protocol.SubscriptionType;
 import org.apache.eventmesh.common.protocol.tcp.Command;
-import org.apache.eventmesh.common.protocol.tcp.Package;
 import org.apache.eventmesh.runtime.client.common.ClientConstants;
 import org.apache.eventmesh.runtime.client.common.MessageUtils;
-import org.apache.eventmesh.runtime.client.hook.ReceiveMsgHook;
 import org.apache.eventmesh.runtime.client.impl.SubClientImpl;
 
-import io.netty.channel.ChannelHandlerContext;
-
 
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public class SyncSubClient {
 
+
     public static void main(String[] args) throws Exception {
         try (SubClientImpl client =
-                     new SubClientImpl("localhost", 10000, MessageUtils.generateSubServer())) {
+            new SubClientImpl("localhost", 10000, MessageUtils.generateSubServer())) {
             client.init();
             client.heartbeat();
             client.justSubscribe(ClientConstants.SYNC_TOPIC, SubscriptionMode.CLUSTERING, SubscriptionType.SYNC);
-            client.registerBusiHandler(new ReceiveMsgHook() {
-                @Override
-                public void handle(Package msg, ChannelHandlerContext ctx) {
-                    if (msg.getHeader().getCommand() == Command.REQUEST_TO_CLIENT) {
-                        if ((log.isInfoEnabled())) {
-                            log.info("receive message -------------------------------" + msg);
-                        }
+            client.registerBusiHandler((msg, ctx) -> {
+                if (msg.getHeader().getCommand() == Command.REQUEST_TO_CLIENT) {
+                    if ((log.isInfoEnabled())) {
+                        log.info("receive message:{}", msg);
                     }
                 }
             });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org