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 4df4803c2 [ISSUE #4088] Anonymous new can be replaced with
lambda.[BroadCastSubClient] (#4617)
4df4803c2 is described below
commit 4df4803c23fc517f46aeeb2a350e3e9b1a2e8972
Author: Ashutosh <[email protected]>
AuthorDate: Thu Dec 7 14:09:28 2023 +0530
[ISSUE #4088] Anonymous new can be replaced with
lambda.[BroadCastSubClient] (#4617)
* Issue Fix: #4088
* Issue Fix: #4088
Modified changes as suggested
* formatted
* Issue Fix: #4088
fixed codestyle
---
.../eventmesh/runtime/demo/BroadCastSubClient.java | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java
index a94e5a97c..50ac95de4 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java
@@ -21,14 +21,10 @@ 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.EventMeshMessage;
-import org.apache.eventmesh.common.protocol.tcp.Package;
-import org.apache.eventmesh.common.utils.LogUtils;
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;
@@ -40,14 +36,12 @@ public class BroadCastSubClient {
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();
- LogUtils.info(log, "receive message
-------------------------------{}", body);
+ client.registerBusiHandler((msg, 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);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]