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 d7abc3113 [ISSUE #4087] Anonymous new can be replaced with lambda
(#4391)
d7abc3113 is described below
commit d7abc31137e4472b90d0f7ae83a5098f8bd4b916
Author: Kartik Tayal <[email protected]>
AuthorDate: Wed Aug 23 07:01:30 2023 +0530
[ISSUE #4087] Anonymous new can be replaced with lambda (#4391)
---
.../apache/eventmesh/runtime/demo/AsyncSubClient.java | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/AsyncSubClient.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/AsyncSubClient.java
index 3bf809936..92a2431f1 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/AsyncSubClient.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/AsyncSubClient.java
@@ -20,15 +20,10 @@ 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.EventMeshMessage;
-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
@@ -40,14 +35,11 @@ public class AsyncSubClient {
client.init();
client.heartbeat();
client.justSubscribe(ClientConstants.ASYNC_TOPIC,
SubscriptionMode.CLUSTERING, SubscriptionType.ASYNC);
- client.registerBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- if (msg.getBody() instanceof EventMeshMessage) {
- String body = ((EventMeshMessage)
msg.getBody()).getBody();
- if (log.isInfoEnabled()) {
- log.info("receive message
-------------------------------" + body);
- }
+ client.registerBusiHandler((msg, ctx) -> {
+ 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]