This is an automated email from the ASF dual-hosted git repository.
mikexue 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 a18ff1f8b [ISSUE #4089] Anonymous new can be replaced with
lambda.[CClientDemo] (#4461)
a18ff1f8b is described below
commit a18ff1f8b5b9fa7e2677af8b2c54a4ec1d74882a
Author: PAN <[email protected]>
AuthorDate: Mon Sep 25 16:16:38 2023 +0800
[ISSUE #4089] Anonymous new can be replaced with lambda.[CClientDemo]
(#4461)
* Anonymous new can be replaced with lambda.[CClientDemo]
* fix
---
.../org/apache/eventmesh/runtime/demo/CClientDemo.java | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/CClientDemo.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/CClientDemo.java
index 580fe5cd8..dff1a4302 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/CClientDemo.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/CClientDemo.java
@@ -20,12 +20,9 @@ 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.MessageUtils;
-import org.apache.eventmesh.runtime.client.hook.ReceiveMsgHook;
import org.apache.eventmesh.runtime.client.impl.EventMeshClientImpl;
-import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
@@ -45,13 +42,10 @@ public class CClientDemo {
client.justSubscribe(ASYNC_TOPIC, SubscriptionMode.CLUSTERING,
SubscriptionType.ASYNC);
client.justSubscribe(BROADCAST_TOPIC, SubscriptionMode.BROADCASTING,
SubscriptionType.ASYNC);
client.listen();
- client.registerSubBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- if (msg.getHeader().getCmd() ==
Command.ASYNC_MESSAGE_TO_CLIENT || msg.getHeader().getCmd() ==
Command.BROADCAST_MESSAGE_TO_CLIENT) {
- if (log.isInfoEnabled()) {
- log.info("receive message: {}", msg);
- }
+ client.registerSubBusiHandler((msg, ctx) -> {
+ if (msg.getHeader().getCmd() == Command.ASYNC_MESSAGE_TO_CLIENT ||
msg.getHeader().getCmd() == Command.BROADCAST_MESSAGE_TO_CLIENT) {
+ if (log.isInfoEnabled()) {
+ log.info("receive message: {}", msg);
}
}
});
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]