clients = Lists.newArrayList();
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/push/HTTPMessageHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/HTTPMessageHandler.java
similarity index 93%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/push/HTTPMessageHandler.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/HTTPMessageHandler.java
index 7d5d0e3738..f0e0ee87f7 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/push/HTTPMessageHandler.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/HTTPMessageHandler.java
@@ -15,16 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.http.push;
-
-import com.webank.eventmesh.runtime.core.protocol.http.consumer.HandleMsgContext;
-import com.webank.eventmesh.runtime.core.protocol.http.consumer.EventMeshConsumer;
-import com.webank.eventmesh.common.ThreadPoolFactory;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.apache.commons.collections4.MapUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.core.protocol.http.push;
import java.util.Map;
import java.util.Set;
@@ -33,6 +24,16 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+import org.apache.commons.collections4.MapUtils;
+import org.apache.eventmesh.common.ThreadPoolFactory;
+import org.apache.eventmesh.runtime.core.protocol.http.consumer.EventMeshConsumer;
+import org.apache.eventmesh.runtime.core.protocol.http.consumer.HandleMsgContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class HTTPMessageHandler implements MessageHandler {
public Logger logger = LoggerFactory.getLogger(this.getClass());
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/push/MessageHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/MessageHandler.java
similarity index 87%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/push/MessageHandler.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/MessageHandler.java
index 7eb4c84420..403ed8e3f5 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/push/MessageHandler.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/MessageHandler.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.http.push;
+package org.apache.eventmesh.runtime.core.protocol.http.push;
-import com.webank.eventmesh.runtime.core.protocol.http.consumer.HandleMsgContext;
+import org.apache.eventmesh.runtime.core.protocol.http.consumer.HandleMsgContext;
public interface MessageHandler {
boolean handle(HandleMsgContext handleMsgContext);
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/DelayRetryable.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/DelayRetryable.java
similarity index 93%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/DelayRetryable.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/DelayRetryable.java
index 5a6ad814f8..194322576a 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/DelayRetryable.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/DelayRetryable.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.http.retry;
+package org.apache.eventmesh.runtime.core.protocol.http.retry;
import java.util.concurrent.Delayed;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/HttpRetryer.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/HttpRetryer.java
similarity index 95%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/HttpRetryer.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/HttpRetryer.java
index 931153b0be..6147f7b3d6 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/HttpRetryer.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/HttpRetryer.java
@@ -15,11 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.http.retry;
-
-import com.webank.eventmesh.runtime.boot.EventMeshHTTPServer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.core.protocol.http.retry;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.DelayQueue;
@@ -28,6 +24,10 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class HttpRetryer {
private Logger retryLogger = LoggerFactory.getLogger("retry");
@@ -81,7 +81,7 @@ public void run() {
pool.execute(() -> {
try {
delayRetryable.retry();
- if(retryLogger.isDebugEnabled()) {
+ if (retryLogger.isDebugEnabled()) {
retryLogger.debug("retryObj : {}", delayRetryable);
}
} catch (Exception e) {
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/RetryContext.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/RetryContext.java
similarity index 96%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/RetryContext.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/RetryContext.java
index 6c9717cff4..7841cca1e4 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/http/retry/RetryContext.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/retry/RetryContext.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.http.retry;
+package org.apache.eventmesh.runtime.core.protocol.http.retry;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcp2Client.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcp2Client.java
similarity index 72%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcp2Client.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcp2Client.java
index 2a22648fe6..17868c6e97 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcp2Client.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcp2Client.java
@@ -15,44 +15,45 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client;
-
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.group.ClientSessionGroupMapping;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.SessionState;
-import com.webank.eventmesh.runtime.util.RemotingHelper;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.RedirectInfo;
-import com.webank.eventmesh.runtime.metrics.tcp.EventMeshTcpMonitor;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.REDIRECT_TO_CLIENT;
+import static org.apache.eventmesh.common.protocol.tcp.Command.SERVER_GOODBYE_REQUEST;
+
+import java.net.InetSocketAddress;
+import java.util.concurrent.TimeUnit;
+
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.RedirectInfo;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.group.ClientSessionGroupMapping;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.SessionState;
+import org.apache.eventmesh.runtime.metrics.tcp.EventMeshTcpMonitor;
+import org.apache.eventmesh.runtime.util.RemotingHelper;
+import org.apache.eventmesh.runtime.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.net.InetSocketAddress;
-import java.util.concurrent.TimeUnit;
-
-import static com.webank.eventmesh.common.protocol.tcp.Command.REDIRECT_TO_CLIENT;
-import static com.webank.eventmesh.common.protocol.tcp.Command.SERVER_GOODBYE_REQUEST;
-
public class EventMeshTcp2Client {
private static final Logger logger = LoggerFactory.getLogger(EventMeshTcp2Client.class);
- public static InetSocketAddress serverGoodby2Client(Session session, ClientSessionGroupMapping mapping) {
+ public static InetSocketAddress serverGoodby2Client(EventMeshTCPServer eventMeshTCPServer,Session session, ClientSessionGroupMapping mapping) {
logger.info("serverGoodby2Client client[{}]", session.getClient());
- try{
+ try {
long startTime = System.currentTimeMillis();
Package msg = new Package();
msg.setHeader(new Header(SERVER_GOODBYE_REQUEST, OPStatus.SUCCESS.getCode(), "graceful normal quit from eventmesh",
null));
- EventMeshTCPServer.scheduler.submit(new Runnable() {
+ eventMeshTCPServer.getScheduler().submit(new Runnable() {
@Override
public void run() {
long taskExecuteTime = System.currentTimeMillis();
@@ -61,23 +62,24 @@ public void run() {
});
InetSocketAddress address = (InetSocketAddress) session.getContext().channel().remoteAddress();
- closeSessionIfTimeout(session, mapping);
+ closeSessionIfTimeout(eventMeshTCPServer,session, mapping);
return address;
- }catch (Exception e){
+ } catch (Exception e) {
logger.error("exception occur while serverGoodby2Client", e);
return null;
}
}
- public static InetSocketAddress goodBye2Client(Session session,
+ public static InetSocketAddress goodBye2Client(EventMeshTCPServer eventMeshTCPServer,
+ Session session,
String errMsg,
int eventMeshStatus,
ClientSessionGroupMapping mapping) {
try {
long startTime = System.currentTimeMillis();
Package msg = new Package();
- msg.setHeader(new Header(SERVER_GOODBYE_REQUEST, eventMeshStatus, errMsg,null));
- EventMeshTCPServer.scheduler.schedule(new Runnable() {
+ msg.setHeader(new Header(SERVER_GOODBYE_REQUEST, eventMeshStatus, errMsg, null));
+ eventMeshTCPServer.getScheduler().schedule(new Runnable() {
@Override
public void run() {
long taskExecuteTime = System.currentTimeMillis();
@@ -85,7 +87,7 @@ public void run() {
}
}, 1 * 1000, TimeUnit.MILLISECONDS);
- closeSessionIfTimeout(session, mapping);
+ closeSessionIfTimeout(eventMeshTCPServer,session, mapping);
return session.getRemoteAddress();
} catch (Exception e) {
@@ -118,7 +120,7 @@ public void operationComplete(ChannelFuture future) throws Exception {
);
}
- public static String redirectClient2NewEventMesh(String newEventMeshIp, int port, Session session, ClientSessionGroupMapping mapping) {
+ public static String redirectClient2NewEventMesh(EventMeshTCPServer eventMeshTCPServer,String newEventMeshIp, int port, Session session, ClientSessionGroupMapping mapping) {
logger.info("begin to gracefully redirect Client {}, newIPPort[{}]", session.getClient(), newEventMeshIp + ":" + port);
try {
long startTime = System.currentTimeMillis();
@@ -127,14 +129,14 @@ public static String redirectClient2NewEventMesh(String newEventMeshIp, int port
pkg.setHeader(new Header(REDIRECT_TO_CLIENT, OPStatus.SUCCESS.getCode(), null,
null));
pkg.setBody(new RedirectInfo(newEventMeshIp, port));
- EventMeshTCPServer.scheduler.schedule(new Runnable() {
+ eventMeshTCPServer.getScheduler().schedule(new Runnable() {
@Override
public void run() {
long taskExecuteTime = System.currentTimeMillis();
Utils.writeAndFlush(pkg, startTime, taskExecuteTime, session.getContext(), session);
}
}, 5 * 1000, TimeUnit.MILLISECONDS);
- closeSessionIfTimeout(session, mapping);
+ closeSessionIfTimeout(eventMeshTCPServer,session, mapping);
return session.getRemoteAddress() + "--->" + newEventMeshIp + ":" + port;
} catch (Exception e) {
logger.error("exception occur while redirectClient2NewEventMesh", e);
@@ -142,12 +144,12 @@ public void run() {
}
}
- public static void closeSessionIfTimeout(Session session, ClientSessionGroupMapping mapping) {
- EventMeshTCPServer.scheduler.schedule(new Runnable() {
+ public static void closeSessionIfTimeout(EventMeshTCPServer eventMeshTCPServer,Session session, ClientSessionGroupMapping mapping) {
+ eventMeshTCPServer.getScheduler().schedule(new Runnable() {
@Override
public void run() {
try {
- if(!session.getSessionState().equals(SessionState.CLOSED)){
+ if (!session.getSessionState().equals(SessionState.CLOSED)) {
mapping.closeSession(session.getContext());
logger.info("closeSessionIfTimeout success, session[{}]", session.getClient());
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpConnectionHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpConnectionHandler.java
similarity index 95%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpConnectionHandler.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpConnectionHandler.java
index 29bbcd3ff2..f091ac41aa 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpConnectionHandler.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpConnectionHandler.java
@@ -15,19 +15,20 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client;
+
+import java.util.concurrent.atomic.AtomicInteger;
-import com.webank.eventmesh.runtime.util.RemotingHelper;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
+
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.util.RemotingHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
public class EventMeshTcpConnectionHandler extends ChannelDuplexHandler {
public static AtomicInteger connections = new AtomicInteger(0);
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpExceptionHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpExceptionHandler.java
similarity index 82%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpExceptionHandler.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpExceptionHandler.java
index 0cd0a0b0de..d6ed12a30f 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpExceptionHandler.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpExceptionHandler.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,7 +49,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws E
}
if (session != null) {
- EventMeshTcp2Client.goodBye2Client(session, errMsg, OPStatus.FAIL.getCode(), eventMeshTCPServer.getClientSessionGroupMapping());
+ EventMeshTcp2Client.goodBye2Client(eventMeshTCPServer, session, errMsg, OPStatus.FAIL.getCode(), eventMeshTCPServer.getClientSessionGroupMapping());
} else {
EventMeshTcp2Client.goodBye2Client(ctx, errMsg, eventMeshTCPServer.getClientSessionGroupMapping(), eventMeshTCPServer.getEventMeshTcpMonitor());
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpMessageDispatcher.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpMessageDispatcher.java
similarity index 83%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpMessageDispatcher.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpMessageDispatcher.java
index 7ffc4bc4d4..cbe74f4a2e 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpMessageDispatcher.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/EventMeshTcpMessageDispatcher.java
@@ -15,24 +15,25 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.SessionState;
-import com.webank.eventmesh.runtime.util.EventMeshUtil;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.task.GoodbyeTask;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.task.HeartBeatTask;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.task.HelloTask;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.task.ListenTask;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.task.MessageAckTask;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.task.MessageTransferTask;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.task.SubscribeTask;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.task.UnSubscribeTask;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
+
+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.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.SessionState;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.task.GoodbyeTask;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.task.HeartBeatTask;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.task.HelloTask;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.task.ListenTask;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.task.MessageAckTask;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.task.MessageTransferTask;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.task.SubscribeTask;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.task.UnSubscribeTask;
+import org.apache.eventmesh.runtime.util.EventMeshUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,6 +46,7 @@ public class EventMeshTcpMessageDispatcher extends SimpleChannelInboundHandler paramValues = new ArrayList();
paramValues.add("msg");
paramValues.add(JSON.toJSONString(msg));
@@ -740,14 +753,16 @@ private String pushMsgToEventMesh(Message msg, String ip, int port) {
"UTF-8",
3000);
} catch (Exception e) {
- throw new RuntimeException("httpPost " + targetUrl + " is fail," + e);
+ logger.error("httpPost " + targetUrl + " is fail,", e);
+ //throw new RuntimeException("httpPost " + targetUrl + " is fail," , e);
+ throw e;
}
if (200 == result.code && result.content != null) {
return result.content;
} else {
- throw new RuntimeException("httpPost targetUrl[" + targetUrl + "] is not OK when getContentThroughHttp, httpResult: " + result + ".");
+ throw new Exception("httpPost targetUrl[" + targetUrl + "] is not OK when getContentThroughHttp, httpResult: " + result + ".");
}
}
@@ -755,12 +770,12 @@ public MQConsumerWrapper getPersistentMsgConsumer() {
return persistentMsgConsumer;
}
- private void sendMsgBackToBroker(Message msg, String bizSeqNo){
+ private void sendMsgBackToBroker(Message msg, String bizSeqNo) throws Exception {
try {
String topic = msg.getSystemProperties(Constants.PROPERTY_MESSAGE_DESTINATION);
- logger.warn("send msg back to broker, bizSeqno:{}, topic:{}",bizSeqNo, topic);
+ logger.warn("send msg back to broker, bizSeqno:{}, topic:{}", bizSeqNo, topic);
- send(new UpStreamMsgContext(null,null, msg), new SendCallback() {
+ send(new UpStreamMsgContext(null, null, msg), new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
logger.info("consumerGroup:{} consume fail, sendMessageBack success, bizSeqno:{}, topic:{}", groupName, bizSeqNo, topic);
@@ -777,8 +792,9 @@ public void onException(OnExceptionContext context) {
// }
});
eventMeshTcpMonitor.getEventMesh2mqMsgNum().incrementAndGet();
- }catch (Exception e){
+ } catch (Exception e) {
logger.warn("try send msg back to broker failed");
+ throw e;
}
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/ClientSessionGroupMapping.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/ClientSessionGroupMapping.java
similarity index 82%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/ClientSessionGroupMapping.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/ClientSessionGroupMapping.java
index 7beb4d18b2..a33baf1b19 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/ClientSessionGroupMapping.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/ClientSessionGroupMapping.java
@@ -15,36 +15,43 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.group;
-
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.group.dispatch.FreePriorityDispatchStrategy;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.SessionState;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push.ClientAckContext;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push.DownStreamMsgContext;
-import com.webank.eventmesh.runtime.util.EventMeshUtil;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcp2Client;
-import com.webank.eventmesh.common.ThreadUtil;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.runtime.util.RemotingHelper;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.group;
+
+import java.lang.ref.WeakReference;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
+
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.ThreadUtil;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcp2Client;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.group.dispatch.DownstreamDispatchStrategy;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.group.dispatch.FreePriorityDispatchStrategy;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.SessionState;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push.ClientAckContext;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push.DownStreamMsgContext;
+import org.apache.eventmesh.runtime.util.EventMeshUtil;
+import org.apache.eventmesh.runtime.util.RemotingHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.lang.ref.WeakReference;
-import java.net.InetSocketAddress;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
public class ClientSessionGroupMapping {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -88,13 +95,13 @@ public Session createSession(UserAgent user, ChannelHandlerContext ctx) throws E
user.setHost(addr.getHostString());
user.setPort(addr.getPort());
Session session = null;
- if(!sessionTable.containsKey(addr)){
+ if (!sessionTable.containsKey(addr)) {
logger.info("createSession client[{}]", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
session = new Session(user, ctx, eventMeshTCPServer.getEventMeshTCPConfiguration());
initClientGroupWrapper(user, session);
sessionTable.put(addr, session);
sessionLogger.info("session|open|succeed|user={}", user);
- }else {
+ } else {
session = sessionTable.get(addr);
sessionLogger.error("session|open|failed|user={}|msg={}", user, "session has been created!");
}
@@ -142,7 +149,7 @@ private void closeSession(Session session) throws Exception {
}
//session must be synchronized to avoid SessionState be confound, for example adding subscribe when session closing
- synchronized (session){
+ synchronized (session) {
if (SessionState.CLOSED == session.getSessionState()) {
logger.info("session has been closed in sync, addr:{}", remoteAddress);
@@ -153,9 +160,9 @@ private void closeSession(Session session) throws Exception {
if (EventMeshConstants.PURPOSE_SUB.equals(session.getClient().getPurpose())) {
cleanClientGroupWrapperByCloseSub(session);
- }else if (EventMeshConstants.PURPOSE_PUB.equals(session.getClient().getPurpose())) {
+ } else if (EventMeshConstants.PURPOSE_PUB.equals(session.getClient().getPurpose())) {
cleanClientGroupWrapperByClosePub(session);
- }else{
+ } else {
logger.error("client purpose config is error:{}", session.getClient().getPurpose());
}
@@ -172,17 +179,24 @@ public void operationComplete(ChannelFuture future) throws Exception {
}
}
- private void initClientGroupWrapper(UserAgent user, Session session) throws Exception {
+ private ClientGroupWrapper constructClientGroupWrapper(String sysId, String dcn,
+ EventMeshTCPServer eventMeshTCPServer,
+ DownstreamDispatchStrategy downstreamDispatchStrategy) {
+ return new ClientGroupWrapper(sysId, dcn
+ , eventMeshTCPServer, downstreamDispatchStrategy);
+ }
+
+ private void initClientGroupWrapper(UserAgent user, Session session) throws Exception {
final String clientGroup = EventMeshUtil.buildClientGroup(user.getSubsystem(), user.getDcn());
- if(!lockMap.containsKey(clientGroup)){
+ if (!lockMap.containsKey(clientGroup)) {
Object obj = lockMap.putIfAbsent(clientGroup, new Object());
- if(obj == null) {
+ if (obj == null) {
logger.info("add lock to map for group:{}", clientGroup);
}
}
synchronized (lockMap.get(clientGroup)) {
if (!clientGroupMap.containsKey(clientGroup)) {
- ClientGroupWrapper cgw = new ClientGroupWrapper(user.getSubsystem(), user.getDcn()
+ ClientGroupWrapper cgw = constructClientGroupWrapper(user.getSubsystem(), user.getDcn()
, eventMeshTCPServer, new FreePriorityDispatchStrategy());
clientGroupMap.put(clientGroup, cgw);
logger.info("create new ClientGroupWrapper,group:{}", clientGroup);
@@ -190,11 +204,11 @@ private void initClientGroupWrapper(UserAgent user, Session session) throws Exc
ClientGroupWrapper cgw = clientGroupMap.get(clientGroup);
- if (EventMeshConstants.PURPOSE_PUB.equals(user.getPurpose())){
+ if (EventMeshConstants.PURPOSE_PUB.equals(user.getPurpose())) {
startClientGroupProducer(cgw, session);
- }else if (EventMeshConstants.PURPOSE_SUB.equals(user.getPurpose())) {
+ } else if (EventMeshConstants.PURPOSE_SUB.equals(user.getPurpose())) {
initClientGroupConsumser(cgw);
- }else{
+ } else {
logger.error("unknown client purpose:{}", user.getPurpose());
throw new Exception("client purpose config is error");
}
@@ -208,7 +222,7 @@ private void startClientGroupProducer(ClientGroupWrapper cgw, Session session) t
cgw.startClientGroupProducer();
}
boolean flag = cgw.addGroupProducerSession(session);
- if(!flag){
+ if (!flag) {
throw new Exception("addGroupProducerSession fail");
}
session.setSessionState(SessionState.RUNNING);
@@ -230,7 +244,7 @@ private void initClientGroupConsumser(ClientGroupWrapper cgw) throws Exception {
private void startClientGroupConsumer(Session session) throws Exception {
final String clientGroup = EventMeshUtil.buildClientGroup(session.getClient().getSubsystem(), session.getClient().getDcn());
- if(!lockMap.containsKey(clientGroup)){
+ if (!lockMap.containsKey(clientGroup)) {
lockMap.putIfAbsent(clientGroup, new Object());
}
synchronized (lockMap.get(clientGroup)) {
@@ -238,7 +252,7 @@ private void startClientGroupConsumer(Session session) throws Exception {
ClientGroupWrapper cgw = session.getClientGroupWrapper().get();
boolean flag = cgw.addGroupConsumerSession(session);
- if(!flag){
+ if (!flag) {
throw new Exception("addGroupConsumerSession fail");
}
@@ -283,22 +297,22 @@ private void cleanSubscriptionInSession(Session session) throws Exception {
*
* @param session
*/
- private void handleUnackMsgsInSession(Session session){
+ private void handleUnackMsgsInSession(Session session) {
ConcurrentHashMap unAckMsg = session.getPusher().getPushContext().getUnAckMsg();
- if(unAckMsg.size() > 0 && session.getClientGroupWrapper().get().getGroupConsumerSessions().size() > 0){
- for(Map.Entry entry : unAckMsg.entrySet()){
+ if (unAckMsg.size() > 0 && session.getClientGroupWrapper().get().getGroupConsumerSessions().size() > 0) {
+ for (Map.Entry entry : unAckMsg.entrySet()) {
ClientAckContext ackContext = entry.getValue();
- if(EventMeshUtil.isBroadcast(ackContext.getMsgs().get(0).getSystemProperties(Constants.PROPERTY_MESSAGE_DESTINATION))){
- logger.warn("exist broadcast msg unack when closeSession,seq:{},bizSeq:{},client:{}",ackContext.getSeq(), EventMeshUtil.getMessageBizSeq(ackContext.getMsgs().get(0)),session.getClient());
+ if (EventMeshUtil.isBroadcast(ackContext.getMsgs().get(0).getSystemProperties(Constants.PROPERTY_MESSAGE_DESTINATION))) {
+ logger.warn("exist broadcast msg unack when closeSession,seq:{},bizSeq:{},client:{}", ackContext.getSeq(), EventMeshUtil.getMessageBizSeq(ackContext.getMsgs().get(0)), session.getClient());
continue;
}
- List list = new ArrayList(session.getClientGroupWrapper().get().getGroupConsumerSessions());
+ List list = new ArrayList<>(session.getClientGroupWrapper().get().getGroupConsumerSessions());
Collections.shuffle(list);
- DownStreamMsgContext downStreamMsgContext= new DownStreamMsgContext(ackContext.getMsgs().get(0),list.get(0),ackContext.getConsumer(), ackContext.getContext(), false);
+ DownStreamMsgContext downStreamMsgContext = new DownStreamMsgContext(ackContext.getMsgs().get(0), list.get(0), ackContext.getConsumer(), ackContext.getContext(), false);
downStreamMsgContext.delay(0L);
eventMeshTCPServer.getEventMeshTcpRetryer().pushRetry(downStreamMsgContext);
- logger.warn("rePush msg form unAckMsgs,seq:{},rePushSeq:{},rePushClient:{}",entry.getKey(), downStreamMsgContext.seq, downStreamMsgContext.session.getClient());
+ logger.warn("rePush msg form unAckMsgs,seq:{},rePushSeq:{},rePushClient:{}", entry.getKey(), downStreamMsgContext.seq, downStreamMsgContext.session.getClient());
}
}
}
@@ -338,7 +352,7 @@ private void shutdownClientGroupProducer(Session session) throws Exception {
}
private void initSessionCleaner() {
- EventMeshTCPServer.scheduler.scheduleAtFixedRate(new Runnable() {
+ eventMeshTCPServer.getScheduler().scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Iterator sessionIterator = sessionTable.values().iterator();
@@ -358,7 +372,7 @@ public void run() {
}
private void initSessionAckContextCleaner() {
- eventMeshTCPServer.scheduler.scheduleAtFixedRate(new Runnable() {
+ eventMeshTCPServer.getScheduler().scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Iterator sessionIterator = sessionTable.values().iterator();
@@ -381,7 +395,7 @@ public void run() {
}
private void initDownStreamMsgContextCleaner() {
- EventMeshTCPServer.scheduler.scheduleAtFixedRate(new Runnable() {
+ eventMeshTCPServer.getScheduler().scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Iterator cgwIterator = clientGroupMap.values().iterator();
@@ -419,7 +433,7 @@ public void shutdown() throws Exception {
logger.info("begin to close sessions gracefully");
sessionTable.values().parallelStream().forEach(itr -> {
try {
- EventMeshTcp2Client.serverGoodby2Client(itr, this);
+ EventMeshTcp2Client.serverGoodby2Client(this.eventMeshTCPServer,itr, this);
} catch (Exception e) {
logger.error("say goodbye to session error! {}", itr, e);
}
@@ -455,11 +469,11 @@ public HashMap statDCNSystemInfoByPurpose(String purpose)
HashMap result = new HashMap();
if (!sessionTable.isEmpty()) {
for (Session session : sessionTable.values()) {
- if(!StringUtils.equals(session.getClient().getPurpose(), purpose)){
+ if (!StringUtils.equals(session.getClient().getPurpose(), purpose)) {
continue;
}
- String key = session.getClient().getDcn() + "|" + session.getClient().getSubsystem()+ "|" + purpose;
+ String key = session.getClient().getDcn() + "|" + session.getClient().getSubsystem() + "|" + purpose;
if (!result.containsKey(key)) {
result.put(key, new AtomicInteger(1));
} else {
@@ -470,15 +484,15 @@ public HashMap statDCNSystemInfoByPurpose(String purpose)
return result;
}
- public Map> prepareEventMeshClientDistributionData(){
+ public Map> prepareEventMeshClientDistributionData() {
Map> result = null;
- if(!clientGroupMap.isEmpty()){
+ if (!clientGroupMap.isEmpty()) {
result = new HashMap<>();
- for(Map.Entry entry : clientGroupMap.entrySet()){
- Map map = new HashMap();
- map.put(EventMeshConstants.PURPOSE_SUB,entry.getValue().getGroupConsumerSessions().size());
- map.put(EventMeshConstants.PURPOSE_PUB,entry.getValue().getGroupProducerSessions().size());
+ for (Map.Entry entry : clientGroupMap.entrySet()) {
+ Map map = new HashMap<>();
+ map.put(EventMeshConstants.PURPOSE_SUB, entry.getValue().getGroupConsumerSessions().size());
+ map.put(EventMeshConstants.PURPOSE_PUB, entry.getValue().getGroupProducerSessions().size());
result.put(entry.getKey(), map);
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/DownstreamDispatchStrategy.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/DownstreamDispatchStrategy.java
similarity index 88%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/DownstreamDispatchStrategy.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/DownstreamDispatchStrategy.java
index f1cfa63123..27169ff47a 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/DownstreamDispatchStrategy.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/DownstreamDispatchStrategy.java
@@ -15,16 +15,17 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.group.dispatch;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.group.dispatch;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-
import java.util.Set;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+
public interface DownstreamDispatchStrategy {
/**
* 选择一个SESSION
+ *
* @param group
* @param consumeSessions
* @return
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/FreePriorityDispatchStrategy.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/FreePriorityDispatchStrategy.java
similarity index 87%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/FreePriorityDispatchStrategy.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/FreePriorityDispatchStrategy.java
index a6ad47d251..77971583ca 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/FreePriorityDispatchStrategy.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/group/dispatch/FreePriorityDispatchStrategy.java
@@ -15,26 +15,26 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.group.dispatch;
-
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.group.dispatch;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class FreePriorityDispatchStrategy implements DownstreamDispatchStrategy {
private static final Logger logger = LoggerFactory.getLogger(FreePriorityDispatchStrategy.class);
@Override
public Session select(String group, String topic, Set groupConsumerSessions) {
- if(CollectionUtils.isEmpty(groupConsumerSessions)
+ if (CollectionUtils.isEmpty(groupConsumerSessions)
|| StringUtils.isBlank(topic)
|| StringUtils.isBlank(group)) {
return null;
@@ -46,7 +46,7 @@ public Session select(String group, String topic, Set groupConsumerSess
if (!session.isAvailable(topic)) {
continue;
}
- if(session.isDownStreamBusy()){
+ if (session.isDownStreamBusy()) {
canDownSessions.add(session);
continue;
}
@@ -54,11 +54,11 @@ public Session select(String group, String topic, Set groupConsumerSess
}
if (CollectionUtils.isEmpty(filtered)) {
- if(CollectionUtils.isEmpty(canDownSessions)){
+ if (CollectionUtils.isEmpty(canDownSessions)) {
logger.warn("all sessions can't downstream msg");
return null;
- }else{
- logger.warn("all sessions are busy,group:{},topic:{}",group,topic);
+ } else {
+ logger.warn("all sessions are busy,group:{},topic:{}", group, topic);
filtered.addAll(canDownSessions);
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/Session.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/Session.java
similarity index 87%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/Session.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/Session.java
index 135d4b0cd8..223974fe95 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/Session.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/Session.java
@@ -15,38 +15,39 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session;
-
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push.DownStreamMsgContext;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push.SessionPusher;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.send.SessionSender;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.send.EventMeshTcpSendResult;
-import com.webank.eventmesh.runtime.configuration.EventMeshTCPConfiguration;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.group.ClientGroupWrapper;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.runtime.util.RemotingHelper;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.LISTEN_RESPONSE;
+
+import java.lang.ref.WeakReference;
+import java.net.InetSocketAddress;
+import java.util.List;
+import java.util.concurrent.locks.ReentrantLock;
+
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.openmessaging.api.Message;
import io.openmessaging.api.SendCallback;
+
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.runtime.configuration.EventMeshTCPConfiguration;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.group.ClientGroupWrapper;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push.DownStreamMsgContext;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push.SessionPusher;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.send.EventMeshTcpSendResult;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.send.SessionSender;
+import org.apache.eventmesh.runtime.util.RemotingHelper;
+import org.apache.eventmesh.runtime.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.lang.ref.WeakReference;
-import java.net.InetSocketAddress;
-import java.util.List;
-import java.util.concurrent.locks.ReentrantLock;
-
-import static com.webank.eventmesh.common.protocol.tcp.Command.LISTEN_RESPONSE;
-
public class Session {
protected final Logger messageLogger = LoggerFactory.getLogger("message");
@@ -207,7 +208,7 @@ public boolean isCanDownStream() {
return pusher.isCanDownStream();
}
- public boolean isIsolated(){
+ public boolean isIsolated() {
return System.currentTimeMillis() < isolateTime;
}
@@ -223,7 +224,7 @@ public void write2Client(final Package pkg) {
public void operationComplete(ChannelFuture future) throws Exception {
if (!future.isSuccess()) {
messageLogger.error("write2Client fail, pkg[{}] session[{}]", pkg, this);
- }else{
+ } else {
clientGroupWrapper.get().getEventMeshTcpMonitor().getEventMesh2clientMsgNum().incrementAndGet();
}
}
@@ -332,20 +333,27 @@ public void setIsolateTime(long isolateTime) {
this.isolateTime = isolateTime;
}
- public boolean isAvailable(String topic){
- if(SessionState.CLOSED == sessionState){
+ public boolean isAvailable(String topic) {
+ if (SessionState.CLOSED == sessionState) {
logger.warn("session is not available because session has been closed");
return false;
}
- if(!sessionContext.subscribeTopics.containsKey(topic)){
- logger.warn("session is not available because session has not subscribe topic:{}",topic);
+ if (!sessionContext.subscribeTopics.containsKey(topic)) {
+ logger.warn("session is not available because session has not subscribe topic:{}", topic);
return false;
}
- if(isIsolated()){
- logger.warn("session is not available because session is isolated,isolateTime:{}",isolateTime);
+ if (isIsolated()) {
+ logger.warn("session is not available because session is isolated,isolateTime:{}", isolateTime);
return false;
}
return true;
}
+
+ @Override
+ public int hashCode() {
+ int code = 37 + (client != null ? client.hashCode() : 0) + (context != null ? context.hashCode() : 0)
+ + (sessionState != null ? sessionState.hashCode() : 0);
+ return code;
+ }
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/SessionContext.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/SessionContext.java
similarity index 92%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/SessionContext.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/SessionContext.java
index 19365503b6..9d5b22e639 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/SessionContext.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/SessionContext.java
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session;
-
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import org.apache.commons.lang3.time.DateFormatUtils;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+
public class SessionContext {
private Session session;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/SessionState.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/SessionState.java
similarity index 93%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/SessionState.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/SessionState.java
index 0c7445f28e..2093a8e4e0 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/SessionState.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/SessionState.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session;
public enum SessionState {
CREATED,
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/ClientAckContext.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/ClientAckContext.java
similarity index 90%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/ClientAckContext.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/ClientAckContext.java
index c0d1c8a24c..0f322d96e4 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/ClientAckContext.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/ClientAckContext.java
@@ -15,21 +15,22 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push;
+
+import java.util.List;
-import com.webank.eventmesh.api.AbstractContext;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.util.EventMeshUtil;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.plugin.MQConsumerWrapper;
import io.openmessaging.api.Message;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.api.AbstractContext;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.plugin.MQConsumerWrapper;
+import org.apache.eventmesh.runtime.util.EventMeshUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.List;
-
public class ClientAckContext {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -109,8 +110,8 @@ public void ackMsg() {
// ConsumeMessageService consumeMessageService = consumer..getDefaultMQPushConsumerImpl().getConsumeMessageService();
// ((ConsumeMessageConcurrentlyService)consumeMessageService).updateOffset(msgs, context);
logger.info("ackMsg topic:{}, bizSeq:{}", msgs.get(0).getSystemProperties(Constants.PROPERTY_MESSAGE_DESTINATION), EventMeshUtil.getMessageBizSeq(msgs.get(0)));
- }else{
- logger.warn("ackMsg failed,consumer is null:{}, context is null:{} , msgs is null:{}",consumer == null, context == null, msgs == null);
+ } else {
+ logger.warn("ackMsg failed,consumer is null:{}, context is null:{} , msgs is null:{}", consumer == null, context == null, msgs == null);
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/DownStreamMsgContext.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/DownStreamMsgContext.java
similarity index 89%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/DownStreamMsgContext.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/DownStreamMsgContext.java
index db3ae09268..06d088de96 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/DownStreamMsgContext.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/DownStreamMsgContext.java
@@ -15,24 +15,25 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push;
-
-import com.webank.eventmesh.api.AbstractContext;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.util.ServerGlobal;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.plugin.MQConsumerWrapper;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import io.openmessaging.api.Message;
-import org.apache.commons.lang3.time.DateFormatUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
+import io.openmessaging.api.Message;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.api.AbstractContext;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.plugin.MQConsumerWrapper;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.util.ServerGlobal;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class DownStreamMsgContext implements Delayed {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -86,8 +87,8 @@ public void ackMsg() {
// ((ConsumeMessageConcurrentlyService)consumeMessageService).updateOffset(msgs, consumeConcurrentlyContext);
logger.info("ackMsg topic:{}, bizSeq:{}", msgs.get(0).getSystemProperties(Constants.PROPERTY_MESSAGE_DESTINATION),
msgs.get(0).getSystemProperties(EventMeshConstants.PROPERTY_MESSAGE_KEYS));
- }else{
- logger.warn("ackMsg failed,consumer is null:{}, context is null:{} , msgs is null:{}",consumer == null, consumeConcurrentlyContext == null, msgExt == null);
+ } else {
+ logger.warn("ackMsg failed,consumer is null:{}, context is null:{} , msgs is null:{}", consumer == null, consumeConcurrentlyContext == null, msgExt == null);
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/PushContext.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/PushContext.java
similarity index 90%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/PushContext.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/PushContext.java
index 604a0058fc..fbe5ac90bd 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/PushContext.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/PushContext.java
@@ -15,19 +15,21 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
-import com.webank.eventmesh.api.AbstractContext;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.plugin.MQConsumerWrapper;
import io.openmessaging.api.Message;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.api.AbstractContext;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.plugin.MQConsumerWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
public class PushContext {
@@ -58,7 +60,7 @@ public void deliverFailMsgCount() {
}
public void unAckMsg(String seq, List msg, AbstractContext context, MQConsumerWrapper consumer) {
- ClientAckContext ackContext = new ClientAckContext(seq,context, msg, consumer);
+ ClientAckContext ackContext = new ClientAckContext(seq, context, msg, consumer);
unAckMsg.put(seq, ackContext);
logger.info("put msg in unAckMsg,seq:{},unAckMsgSize:{}", seq, getTotalUnackMsgs());
}
@@ -72,7 +74,7 @@ public void ackMsg(String seq) {
unAckMsg.get(seq).ackMsg();
unAckMsg.remove(seq);
ackedMsgsCount.incrementAndGet();
- }else{
+ } else {
logger.warn("ackMsg failed,the seq:{} is not in unAckMsg map", seq);
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/SessionPusher.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/SessionPusher.java
similarity index 89%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/SessionPusher.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/SessionPusher.java
index 2f4a2e7936..49c27a457b 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/SessionPusher.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/SessionPusher.java
@@ -15,26 +15,27 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push;
-
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.util.EventMeshUtil;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push;
+
+import java.util.ArrayList;
+import java.util.List;
+
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.openmessaging.api.Message;
+
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.util.EventMeshUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.List;
-
public class SessionPusher {
private final Logger messageLogger = LoggerFactory.getLogger("message");
@@ -134,10 +135,10 @@ public void operationComplete(ChannelFuture future) throws Exception {
session.getClientGroupWrapper().get().getEventMeshTcpRetryer().pushRetry(downStreamMsgContext);
} else {
pushContext.deliveredMsgCount();
- logger.info("downstreamMsg success,seq:{}, retryTimes:{}, bizSeq:{}", downStreamMsgContext.seq,downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
+ logger.info("downstreamMsg success,seq:{}, retryTimes:{}, bizSeq:{}", downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
session.getClientGroupWrapper().get().getDownstreamMap().remove(downStreamMsgContext.seq);
- if(session.isIsolated()){
+ if (session.isIsolated()) {
logger.info("cancel isolated,client:{}", session.getClient());
session.setIsolateTime(System.currentTimeMillis());
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/retry/EventMeshTcpRetryer.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/retry/EventMeshTcpRetryer.java
similarity index 85%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/retry/EventMeshTcpRetryer.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/retry/EventMeshTcpRetryer.java
index 83173c64ee..c3d0cceb77 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/push/retry/EventMeshTcpRetryer.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/push/retry/EventMeshTcpRetryer.java
@@ -15,21 +15,8 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push.retry;
-
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.util.EventMeshThreadFactoryImpl;
-import com.webank.eventmesh.runtime.util.EventMeshUtil;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.runtime.constants.DeFiBusConstant;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push.DownStreamMsgContext;
-//import com.webank.eventmesh.connector.defibus.common.Constants;
-import io.openmessaging.api.Message;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push.retry;
+
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
@@ -37,6 +24,19 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import io.openmessaging.api.Message;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push.DownStreamMsgContext;
+import org.apache.eventmesh.runtime.util.EventMeshThreadFactoryImpl;
+import org.apache.eventmesh.runtime.util.EventMeshUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class EventMeshTcpRetryer {
public static Logger logger = LoggerFactory.getLogger(EventMeshTcpRetryer.class);
@@ -49,7 +49,7 @@ public class EventMeshTcpRetryer {
3,
60000,
TimeUnit.MILLISECONDS, new ArrayBlockingQueue(1000),
- new EventMeshThreadFactoryImpl("eventMesh-tcp-retry",true),
+ new EventMeshThreadFactoryImpl("eventMesh-tcp-retry", true),
new ThreadPoolExecutor.AbortPolicy());
private Thread dispatcher;
@@ -82,7 +82,7 @@ public void pushRetry(DownStreamMsgContext downStreamMsgContext) {
}
retrys.offer(downStreamMsgContext);
- logger.info("pushRetry success,seq:{}, retryTimes:{}, bizSeq:{}",downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
+ logger.info("pushRetry success,seq:{}, retryTimes:{}, bizSeq:{}", downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
}
public void init() {
@@ -106,11 +106,11 @@ public void run() {
logger.info("EventMeshTcpRetryer inited......");
}
- private void retryHandle(DownStreamMsgContext downStreamMsgContext){
+ private void retryHandle(DownStreamMsgContext downStreamMsgContext) {
try {
- logger.info("retry downStream msg start,seq:{},retryTimes:{},bizSeq:{}",downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
+ logger.info("retry downStream msg start,seq:{},retryTimes:{},bizSeq:{}", downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
- if(isRetryMsgTimeout(downStreamMsgContext)){
+ if (isRetryMsgTimeout(downStreamMsgContext)) {
return;
}
downStreamMsgContext.retryTimes++;
@@ -118,17 +118,17 @@ private void retryHandle(DownStreamMsgContext downStreamMsgContext){
Session rechoosen = null;
String topic = downStreamMsgContext.msgExt.getSystemProperties(Constants.PROPERTY_MESSAGE_DESTINATION);
- if(!EventMeshUtil.isBroadcast(topic)){
+ if (!EventMeshUtil.isBroadcast(topic)) {
rechoosen = downStreamMsgContext.session.getClientGroupWrapper()
.get().getDownstreamDispatchStrategy().select(downStreamMsgContext.session.getClientGroupWrapper().get().getGroupName()
, topic
, downStreamMsgContext.session.getClientGroupWrapper().get().getGroupConsumerSessions());
- }else{
+ } else {
rechoosen = downStreamMsgContext.session;
}
- if(rechoosen == null){
+ if (rechoosen == null) {
logger.warn("retry, found no session to downstream msg,seq:{}, retryTimes:{}, bizSeq:{}", downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
// //需要手动ack掉没有下发成功的消息
@@ -143,13 +143,13 @@ private void retryHandle(DownStreamMsgContext downStreamMsgContext){
// //TODO 将消息推给其它eventMesh,待定
// sendMsgToOtherEventMesh(finalDownStreamMsgContext.msgExt, bizSeqNo, uniqueId);
// }
- }else {
+ } else {
downStreamMsgContext.session = rechoosen;
if (rechoosen.isCanDownStream()) {
rechoosen.downstreamMsg(downStreamMsgContext);
- logger.info("retry downStream msg end,seq:{},retryTimes:{},bizSeq:{}",downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
- }else{
+ logger.info("retry downStream msg end,seq:{},retryTimes:{},bizSeq:{}", downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
+ } else {
logger.warn("session is busy,push retry again,seq:{}, session:{}, bizSeq:{}", downStreamMsgContext.seq, downStreamMsgContext.session.getClient(), EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));
long delayTime = EventMeshUtil.isService(topic) ? 0 : eventMeshTCPServer.getEventMeshTCPConfiguration().eventMeshTcpMsgRetryDelayInMills;
downStreamMsgContext.delay(delayTime);
@@ -161,15 +161,15 @@ private void retryHandle(DownStreamMsgContext downStreamMsgContext){
}
}
- private boolean isRetryMsgTimeout(DownStreamMsgContext downStreamMsgContext){
- boolean flag =false;
+ private boolean isRetryMsgTimeout(DownStreamMsgContext downStreamMsgContext) {
+ boolean flag = false;
long ttl = Long.parseLong(downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.PROPERTY_MESSAGE_TTL));
//TODO 关注是否能取到
- long storeTimestamp = Long.parseLong(downStreamMsgContext.msgExt.getUserProperties(DeFiBusConstant.STORE_TIME));
- String leaveTimeStr = downStreamMsgContext.msgExt.getUserProperties(DeFiBusConstant.LEAVE_TIME);
+ long storeTimestamp = Long.parseLong(downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.STORE_TIME));
+ String leaveTimeStr = downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.LEAVE_TIME);
long brokerCost = StringUtils.isNumeric(leaveTimeStr) ? Long.parseLong(leaveTimeStr) - storeTimestamp : 0;
- String arriveTimeStr = downStreamMsgContext.msgExt.getUserProperties(DeFiBusConstant.ARRIVE_TIME);
+ String arriveTimeStr = downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.ARRIVE_TIME);
long accessCost = StringUtils.isNumeric(arriveTimeStr) ? System.currentTimeMillis() - Long.parseLong(arriveTimeStr) : 0;
double elapseTime = brokerCost + accessCost;
if (elapseTime >= ttl) {
@@ -190,7 +190,7 @@ public void shutdown() {
logger.info("EventMeshTcpRetryer shutdown......");
}
- public int getRetrySize(){
+ public int getRetrySize() {
return retrys.size();
}
@@ -199,17 +199,17 @@ public int getRetrySize(){
*
* @param downStreamMsgContext
*/
- private void eventMeshAckMsg(DownStreamMsgContext downStreamMsgContext){
+ private void eventMeshAckMsg(DownStreamMsgContext downStreamMsgContext) {
List msgExts = new ArrayList();
msgExts.add(downStreamMsgContext.msgExt);
- logger.warn("eventMeshAckMsg topic:{}, seq:{}, bizSeq:{}",downStreamMsgContext.msgExt.getSystemProperties(Constants.PROPERTY_MESSAGE_DESTINATION),
+ logger.warn("eventMeshAckMsg topic:{}, seq:{}, bizSeq:{}", downStreamMsgContext.msgExt.getSystemProperties(Constants.PROPERTY_MESSAGE_DESTINATION),
downStreamMsgContext.seq, downStreamMsgContext.msgExt.getSystemProperties(EventMeshConstants.PROPERTY_MESSAGE_KEYS));
downStreamMsgContext.consumer.updateOffset(msgExts, downStreamMsgContext.consumeConcurrentlyContext);
// ConsumeMessageService consumeMessageService = downStreamMsgContext.consumer.getDefaultMQPushConsumer().getDefaultMQPushConsumerImpl().getConsumeMessageService();
// ((ConsumeMessageConcurrentlyService)consumeMessageService).updateOffset(msgExts, downStreamMsgContext.consumeConcurrentlyContext);
}
- public void printRetryThreadPoolState(){
+ public void printRetryThreadPoolState() {
// ThreadPoolHelper.printState(pool);
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendResult.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendResult.java
similarity index 96%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendResult.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendResult.java
index 59b38e4b50..61c4d041e4 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendResult.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendResult.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.send;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.send;
public class EventMeshTcpSendResult {
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendStatus.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendStatus.java
similarity index 93%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendStatus.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendStatus.java
index 664c88637b..75d0823630 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendStatus.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/EventMeshTcpSendStatus.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.send;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.send;
public enum EventMeshTcpSendStatus {
SUCCESS,
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/SessionSender.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/SessionSender.java
similarity index 86%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/SessionSender.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/SessionSender.java
index 6c5427b7b1..e75241cc20 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/SessionSender.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/SessionSender.java
@@ -15,28 +15,29 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.send;
-
-import com.webank.eventmesh.api.RRCallback;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.util.EventMeshUtil;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.constants.DeFiBusConstant;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.send;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+
import io.openmessaging.api.Message;
import io.openmessaging.api.SendCallback;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.api.RRCallback;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.util.EventMeshUtil;
+import org.apache.eventmesh.runtime.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
public class SessionSender {
@@ -65,7 +66,7 @@ public Semaphore getUpstreamBuff() {
return upstreamBuff;
}
- private Semaphore upstreamBuff ;
+ private Semaphore upstreamBuff;
public SessionSender(Session session) {
this.session = session;
@@ -79,13 +80,13 @@ public EventMeshTcpSendResult send(Header header, Message msg, SendCallback send
UpStreamMsgContext upStreamMsgContext = null;
Command cmd = header.getCommand();
if (Command.REQUEST_TO_SERVER == cmd) {
- long ttl = msg.getSystemProperties(DeFiBusConstant.PROPERTY_MESSAGE_TTL) != null ? Long.parseLong(msg.getSystemProperties(DeFiBusConstant.PROPERTY_MESSAGE_TTL)) : EventMeshConstants.DEFAULT_TIMEOUT_IN_MILLISECONDS;
+ long ttl = msg.getSystemProperties(EventMeshConstants.PROPERTY_MESSAGE_TTL) != null ? Long.parseLong(msg.getSystemProperties(EventMeshConstants.PROPERTY_MESSAGE_TTL)) : EventMeshConstants.DEFAULT_TIMEOUT_IN_MILLISECONDS;
upStreamMsgContext = new UpStreamMsgContext(header.getSeq(), session, msg);
session.getClientGroupWrapper().get().request(upStreamMsgContext, sendCallback, initSyncRRCallback(header, startTime, taskExecuteTime), ttl);
} else if (Command.RESPONSE_TO_SERVER == cmd) {
- String cluster = msg.getUserProperties(DeFiBusConstant.PROPERTY_MESSAGE_CLUSTER);
+ String cluster = msg.getUserProperties(EventMeshConstants.PROPERTY_MESSAGE_CLUSTER);
if (!StringUtils.isEmpty(cluster)) {
- String replyTopic = DeFiBusConstant.RR_REPLY_TOPIC;
+ String replyTopic = EventMeshConstants.RR_REPLY_TOPIC;
replyTopic = cluster + "-" + replyTopic;
msg.getSystemProperties().put(Constants.PROPERTY_MESSAGE_DESTINATION, replyTopic);
}
@@ -105,12 +106,12 @@ public EventMeshTcpSendResult send(Header header, Message msg, SendCallback send
session.getClientGroupWrapper().get().getEventMeshTcpMonitor().getEventMesh2mqMsgNum().incrementAndGet();
} else {
- logger.warn("send too fast,session flow control,session:{}",session.getClient());
+ logger.warn("send too fast,session flow control,session:{}", session.getClient());
return new EventMeshTcpSendResult(header.getSeq(), EventMeshTcpSendStatus.SEND_TOO_FAST, EventMeshTcpSendStatus.SEND_TOO_FAST.name());
}
} catch (Exception e) {
logger.warn("SessionSender send failed", e);
- if(!(e instanceof InterruptedException)) {
+ if (!(e instanceof InterruptedException)) {
upstreamBuff.release();
}
failMsgCount.incrementAndGet();
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/UpStreamMsgContext.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/UpStreamMsgContext.java
similarity index 88%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/UpStreamMsgContext.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/UpStreamMsgContext.java
index fa320855a8..1618ce72da 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/session/send/UpStreamMsgContext.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/UpStreamMsgContext.java
@@ -15,13 +15,14 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.session.send;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.session.send;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
import io.openmessaging.api.Message;
+
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
public class UpStreamMsgContext {
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/AbstractTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/AbstractTask.java
similarity index 86%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/AbstractTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/AbstractTask.java
index 1122cf3e6b..64e0eefb5b 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/AbstractTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/AbstractTask.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/GoodbyeTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/GoodbyeTask.java
similarity index 75%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/GoodbyeTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/GoodbyeTask.java
index 235598f4bc..67c0d5cf84 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/GoodbyeTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/GoodbyeTask.java
@@ -15,18 +15,19 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.CLIENT_GOODBYE_RESPONSE;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcp2Client;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
-import static com.webank.eventmesh.common.protocol.tcp.Command.CLIENT_GOODBYE_RESPONSE;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcp2Client;
+import org.apache.eventmesh.runtime.util.Utils;
public class GoodbyeTask extends AbstractTask {
@@ -50,7 +51,7 @@ public void run() {
msg.setHeader(new Header(CLIENT_GOODBYE_RESPONSE, OPStatus.FAIL.getCode(), e.getStackTrace().toString(), pkg
.getHeader().getSeq()));
} finally {
- EventMeshTCPServer.scheduler.submit(new Runnable() {
+ this.eventMeshTCPServer.getScheduler().submit(new Runnable() {
@Override
public void run() {
Utils.writeAndFlush(msg, startTime, taskExecuteTime, session.getContext(), session);
@@ -58,6 +59,6 @@ public void run() {
});
//session.write2Client(msg);
}
- EventMeshTcp2Client.closeSessionIfTimeout(session, eventMeshTCPServer.getClientSessionGroupMapping());
+ EventMeshTcp2Client.closeSessionIfTimeout(this.eventMeshTCPServer,session, eventMeshTCPServer.getClientSessionGroupMapping());
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/HeartBeatTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/HeartBeatTask.java
similarity index 80%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/HeartBeatTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/HeartBeatTask.java
index d939b62a26..eac1354cbe 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/HeartBeatTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/HeartBeatTask.java
@@ -15,16 +15,17 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.HEARTBEAT_RESPONSE;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
-import static com.webank.eventmesh.common.protocol.tcp.Command.HEARTBEAT_RESPONSE;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.util.Utils;
public class HeartBeatTask extends AbstractTask {
@@ -41,11 +42,11 @@ public void run() {
session.notifyHeartbeat(startTime);
}
res.setHeader(new Header(HEARTBEAT_RESPONSE, OPStatus.SUCCESS.getCode(), OPStatus.SUCCESS.getDesc(), pkg.getHeader().getSeq()));
- }catch (Exception e){
+ } catch (Exception e) {
logger.error("HeartBeatTask failed|user={}|errMsg={}", session.getClient(), e);
res.setHeader(new Header(HEARTBEAT_RESPONSE, OPStatus.FAIL.getCode(), "exception while " +
"heartbeating", pkg.getHeader().getSeq()));
- }finally {
+ } finally {
Utils.writeAndFlush(res, startTime, taskExecuteTime, session.getContext(), session);
}
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/HelloTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/HelloTask.java
similarity index 84%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/HelloTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/HelloTask.java
index 0001a79f91..53b97ec66e 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/HelloTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/HelloTask.java
@@ -15,26 +15,27 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.HELLO_RESPONSE;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.runtime.common.ServiceState;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
+
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.common.ServiceState;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static com.webank.eventmesh.common.protocol.tcp.Command.HELLO_RESPONSE;
-
public class HelloTask extends AbstractTask {
private final Logger messageLogger = LoggerFactory.getLogger("message");
@@ -50,7 +51,7 @@ public void run() {
Session session = null;
UserAgent user = (UserAgent) pkg.getBody();
try {
- if(eventMeshTCPServer.getEventMeshServer().getServiceState() != ServiceState.RUNNING){
+ if (eventMeshTCPServer.getEventMeshServer().getServiceState() != ServiceState.RUNNING) {
logger.error("server state is not running:{}", eventMeshTCPServer.getEventMeshServer().getServiceState());
throw new Exception("server state is not running, maybe deploying...");
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/ListenTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/ListenTask.java
similarity index 84%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/ListenTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/ListenTask.java
index a7a5c9dd44..4ce653a403 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/ListenTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/ListenTask.java
@@ -15,15 +15,16 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.LISTEN_RESPONSE;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
-import static com.webank.eventmesh.common.protocol.tcp.Command.LISTEN_RESPONSE;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
public class ListenTask extends AbstractTask {
@@ -44,7 +45,7 @@ public void run() {
logger.error("ListenTask failed|user={}|errMsg={}", session.getClient(), e);
Integer status = OPStatus.FAIL.getCode();
header = new Header(LISTEN_RESPONSE, status, e.toString(), pkg.getHeader().getSeq());
- }finally {
+ } finally {
// res.setHeader(header);
// writeAndFlush(res, startTime, session.getContext(), session);
//session.write2Client(res);
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/MessageAckTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/MessageAckTask.java
similarity index 85%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/MessageAckTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/MessageAckTask.java
index 9bfe00615a..a8605e92f6 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/MessageAckTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/MessageAckTask.java
@@ -15,13 +15,14 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.push.ClientAckContext;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.push.ClientAckContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +45,7 @@ public void run() {
return;
}
ClientAckContext clientAckContext = session.getPusher().getPushContext().getUnAckMsg().get(seq);
- if(clientAckContext != null) {
+ if (clientAckContext != null) {
session.ackMsg(seq);
session.getClientGroupWrapper().get().getDownstreamMap().remove(seq);
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/MessageTransferTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/MessageTransferTask.java
similarity index 88%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/MessageTransferTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/MessageTransferTask.java
index 71c147a042..c903742cdd 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/MessageTransferTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/MessageTransferTask.java
@@ -15,34 +15,34 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
-
-import com.webank.eventmesh.runtime.constants.DeFiBusConstant;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.send.EventMeshTcpSendResult;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.send.EventMeshTcpSendStatus;
-import com.webank.eventmesh.runtime.util.EventMeshUtil;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.RESPONSE_TO_SERVER;
+
+import java.util.concurrent.TimeUnit;
+
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.openmessaging.api.OnExceptionContext;
import io.openmessaging.api.SendCallback;
import io.openmessaging.api.SendResult;
+
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.send.EventMeshTcpSendResult;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.send.EventMeshTcpSendStatus;
+import org.apache.eventmesh.runtime.util.EventMeshUtil;
+import org.apache.eventmesh.runtime.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.TimeUnit;
-
-import static com.webank.eventmesh.common.protocol.tcp.Command.RESPONSE_TO_SERVER;
-
public class MessageTransferTask extends AbstractTask {
private final Logger messageLogger = LoggerFactory.getLogger("message");
@@ -67,7 +67,7 @@ public void run() {
throw new Exception("eventMeshMessage is null");
}
- if (!cmd.equals(RESPONSE_TO_SERVER) && !eventMeshTCPServer.rateLimiter.tryAcquire(TRY_PERMIT_TIME_OUT, TimeUnit.MILLISECONDS)) {
+ if (!cmd.equals(RESPONSE_TO_SERVER) && !eventMeshTCPServer.getRateLimiter().tryAcquire(TRY_PERMIT_TIME_OUT, TimeUnit.MILLISECONDS)) {
msg.setHeader(new Header(replyCmd, OPStatus.FAIL.getCode(), "Tps overload, global flow control", pkg.getHeader().getSeq()));
ctx.writeAndFlush(msg).addListener(
new ChannelFutureListener() {
@@ -77,7 +77,7 @@ public void operationComplete(ChannelFuture future) throws Exception {
}
}
);
- logger.warn("======Tps overload, global flow control, rate:{}! PLEASE CHECK!========", eventMeshTCPServer.rateLimiter.getRate());
+ logger.warn("======Tps overload, global flow control, rate:{}! PLEASE CHECK!========", eventMeshTCPServer.getRateLimiter().getRate());
return;
}
@@ -85,7 +85,7 @@ public void operationComplete(ChannelFuture future) throws Exception {
long sendTime = System.currentTimeMillis();
addTimestamp(eventMeshMessage, cmd, sendTime);
if (cmd.equals(Command.REQUEST_TO_SERVER)) {
- eventMeshMessage.getProperties().put(DeFiBusConstant.PROPERTY_MESSAGE_REPLY_TO, session.getClientGroupWrapper()
+ eventMeshMessage.getProperties().put(EventMeshConstants.PROPERTY_MESSAGE_REPLY_TO, session.getClientGroupWrapper()
.get().getMqProducerWrapper().getMeshMQProducer().buildMQClientId());
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/SubscribeTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/SubscribeTask.java
similarity index 84%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/SubscribeTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/SubscribeTask.java
index 9e0604fc62..e26c66744d 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/SubscribeTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/SubscribeTask.java
@@ -15,23 +15,24 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
+
+import java.util.ArrayList;
+import java.util.List;
-import com.webank.eventmesh.runtime.util.EventMeshUtil;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.Subscription;
import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.Subscription;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.util.EventMeshUtil;
+import org.apache.eventmesh.runtime.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.List;
-
public class SubscribeTask extends AbstractTask {
private final Logger messageLogger = LoggerFactory.getLogger("message");
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/UnSubscribeTask.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/UnSubscribeTask.java
similarity index 86%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/UnSubscribeTask.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/UnSubscribeTask.java
index fd19b662d8..3a338edcd6 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/core/protocol/tcp/client/task/UnSubscribeTask.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/UnSubscribeTask.java
@@ -15,22 +15,23 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.core.protocol.tcp.client.task;
+package org.apache.eventmesh.runtime.core.protocol.tcp.client.task;
+
+import java.util.ArrayList;
+import java.util.List;
-import com.webank.eventmesh.runtime.util.Utils;
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
+
import org.apache.commons.collections4.MapUtils;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.List;
-
public class UnSubscribeTask extends AbstractTask {
private final Logger messageLogger = LoggerFactory.getLogger("message");
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/BytesMessageImpl.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/BytesMessageImpl.java
similarity index 98%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/BytesMessageImpl.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/BytesMessageImpl.java
index ca82dd6016..a91c9a3381 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/BytesMessageImpl.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/BytesMessageImpl.java
@@ -14,7 +14,7 @@
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
-//package com.webank.eventmesh.runtime.domain;
+//package org.apache.eventmesh.runtime.domain;
//
//import io.openmessaging.BytesMessage;
//import io.openmessaging.KeyValue;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/ConsumeRequest.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/ConsumeRequest.java
similarity index 100%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/ConsumeRequest.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/ConsumeRequest.java
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/NonStandardKeys.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/NonStandardKeys.java
similarity index 97%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/NonStandardKeys.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/NonStandardKeys.java
index 745ec5cb15..779b3dccef 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/NonStandardKeys.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/NonStandardKeys.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.domain;
+package org.apache.eventmesh.runtime.domain;
public interface NonStandardKeys {
String CONSUMER_GROUP = "rmq.consumer.group";
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/RocketMQConstants.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/RocketMQConstants.java
similarity index 95%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/RocketMQConstants.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/RocketMQConstants.java
index d31b5875cc..a8f08533df 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/RocketMQConstants.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/RocketMQConstants.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.domain;
+package org.apache.eventmesh.runtime.domain;
public interface RocketMQConstants {
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/SendResultImpl.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/SendResultImpl.java
similarity index 96%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/SendResultImpl.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/SendResultImpl.java
index 9f31d0725f..3a8d12f999 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/domain/SendResultImpl.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/domain/SendResultImpl.java
@@ -14,7 +14,7 @@
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
-//package com.webank.eventmesh.runtime.domain;
+//package org.apache.eventmesh.runtime.domain;
//
//import io.openmessaging.KeyValue;
//import io.openmessaging.producer.SendResult;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/MonitorMetricConstants.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/MonitorMetricConstants.java
similarity index 97%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/MonitorMetricConstants.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/MonitorMetricConstants.java
index 22ec426a28..60a2360ca1 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/MonitorMetricConstants.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/MonitorMetricConstants.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.metrics;
+package org.apache.eventmesh.runtime.metrics;
public class MonitorMetricConstants {
public static final String EVENTMESH_MONITOR_FORMAT_COMMON = "{\"protocol\":\"%s\",\"s\":\"%s\",\"t\":\"%s\"}";
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/GroupMetrics.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/GroupMetrics.java
similarity index 91%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/GroupMetrics.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/GroupMetrics.java
index ebe13821b4..75f3d5d939 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/GroupMetrics.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/GroupMetrics.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.metrics.http;
+package org.apache.eventmesh.runtime.metrics.http;
-import com.webank.eventmesh.runtime.boot.EventMeshHTTPServer;
import com.codahale.metrics.MetricRegistry;
+import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
+
public class GroupMetrics {
private EventMeshHTTPServer eventMeshHTTPServer;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/HTTPMetricsServer.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/HTTPMetricsServer.java
similarity index 98%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/HTTPMetricsServer.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/HTTPMetricsServer.java
index c66e06e526..3e333a0446 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/HTTPMetricsServer.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/HTTPMetricsServer.java
@@ -15,12 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.metrics.http;
-
-import com.webank.eventmesh.runtime.boot.EventMeshHTTPServer;
-import com.codahale.metrics.MetricRegistry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.metrics.http;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -28,6 +23,12 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import com.codahale.metrics.MetricRegistry;
+
+import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class HTTPMetricsServer {
private EventMeshHTTPServer eventMeshHTTPServer;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/HealthMetrics.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/HealthMetrics.java
similarity index 91%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/HealthMetrics.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/HealthMetrics.java
index c40fa82286..6e59fb6369 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/HealthMetrics.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/HealthMetrics.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.metrics.http;
+package org.apache.eventmesh.runtime.metrics.http;
-import com.webank.eventmesh.runtime.boot.EventMeshHTTPServer;
import com.codahale.metrics.MetricRegistry;
+
+import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/SummaryMetrics.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/SummaryMetrics.java
similarity index 99%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/SummaryMetrics.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/SummaryMetrics.java
index f1e25e53f5..01ef0439cd 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/SummaryMetrics.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/SummaryMetrics.java
@@ -15,18 +15,19 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.metrics.http;
-
-import com.webank.eventmesh.runtime.boot.EventMeshHTTPServer;
-import com.codahale.metrics.MetricRegistry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.metrics.http;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicLong;
+import com.codahale.metrics.MetricRegistry;
+
+import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class SummaryMetrics {
public Logger logger = LoggerFactory.getLogger("httpMonitor");
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/TcpSummaryMetrics.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/TcpSummaryMetrics.java
similarity index 99%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/TcpSummaryMetrics.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/TcpSummaryMetrics.java
index 73a3cdd4bf..4c69c67729 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/TcpSummaryMetrics.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/TcpSummaryMetrics.java
@@ -15,18 +15,19 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.metrics.http;
-
-import com.webank.eventmesh.runtime.boot.EventMeshHTTPServer;
-import com.codahale.metrics.MetricRegistry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.metrics.http;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicLong;
+import com.codahale.metrics.MetricRegistry;
+
+import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class TcpSummaryMetrics {
public Logger logger = LoggerFactory.getLogger("httpMonitor");
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/TopicMetrics.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/TopicMetrics.java
similarity index 91%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/TopicMetrics.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/TopicMetrics.java
index 2d89414436..6a0afabdc9 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/http/TopicMetrics.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/TopicMetrics.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.metrics.http;
+package org.apache.eventmesh.runtime.metrics.http;
-import com.webank.eventmesh.runtime.boot.EventMeshHTTPServer;
import com.codahale.metrics.MetricRegistry;
+import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
+
public class TopicMetrics {
private EventMeshHTTPServer eventMeshHTTPServer;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/tcp/EventMeshTcpMonitor.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/tcp/EventMeshTcpMonitor.java
similarity index 93%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/tcp/EventMeshTcpMonitor.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/tcp/EventMeshTcpMonitor.java
index 84528b5ba9..64775275a0 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/metrics/tcp/EventMeshTcpMonitor.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/tcp/EventMeshTcpMonitor.java
@@ -15,15 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.metrics.tcp;
-
-import com.webank.eventmesh.runtime.boot.EventMeshTCPServer;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcpConnectionHandler;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.metrics.MonitorMetricConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.runtime.metrics.tcp;
import java.net.InetSocketAddress;
import java.util.HashSet;
@@ -35,6 +27,14 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcpConnectionHandler;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.metrics.MonitorMetricConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class EventMeshTcpMonitor {
private EventMeshTCPServer eventMeshTCPServer;
@@ -80,7 +80,7 @@ public void init() throws Exception {
}
public void start() throws Exception {
- monitorTpsTask = eventMeshTCPServer.scheduler.scheduleAtFixedRate((new Runnable() {
+ monitorTpsTask = eventMeshTCPServer.getScheduler().scheduleAtFixedRate((new Runnable() {
@Override
public void run() {
int msgNum = client2eventMeshMsgNum.intValue();
@@ -132,7 +132,7 @@ public void run() {
}
}), delay, period, TimeUnit.MILLISECONDS);
- monitorThreadPoolTask = eventMeshTCPServer.scheduler.scheduleAtFixedRate(new Runnable() {
+ monitorThreadPoolTask = eventMeshTCPServer.getScheduler().scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
// ThreadPoolHelper.printThreadPoolState();
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyContext.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyContext.java
similarity index 97%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyContext.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyContext.java
index 3b17f097fb..80c90bf4a5 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyContext.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyContext.java
@@ -15,7 +15,7 @@
// * limitations under the License.
// */
//
-//package com.webank.eventmesh.runtime.patch;
+//package org.apache.eventmesh.runtime.patch;
//
//import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
//import org.apache.rocketmq.client.impl.consumer.ProcessQueue;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyStatus.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyStatus.java
similarity index 96%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyStatus.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyStatus.java
index f3d0756893..008f459f18 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyStatus.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshConsumeConcurrentlyStatus.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.patch;
+package org.apache.eventmesh.runtime.patch;
public enum EventMeshConsumeConcurrentlyStatus {
/**
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshMessageListenerConcurrently.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshMessageListenerConcurrently.java
similarity index 98%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshMessageListenerConcurrently.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshMessageListenerConcurrently.java
index d89d8ad143..202c0e19d1 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/patch/EventMeshMessageListenerConcurrently.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/patch/EventMeshMessageListenerConcurrently.java
@@ -15,7 +15,7 @@
// * limitations under the License.
// */
//
-//package com.webank.eventmesh.runtime.patch;
+//package org.apache.eventmesh.runtime.patch;
//
//import org.apache.commons.collections4.CollectionUtils;
//import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/EventMeshThreadFactoryImpl.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/EventMeshThreadFactoryImpl.java
similarity index 92%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/EventMeshThreadFactoryImpl.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/EventMeshThreadFactoryImpl.java
index f63d5e039d..cf83904115 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/EventMeshThreadFactoryImpl.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/EventMeshThreadFactoryImpl.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.util;
+package org.apache.eventmesh.runtime.util;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
@@ -40,7 +40,7 @@ public String getThreadNamePrefix() {
@Override
public Thread newThread(Runnable r) {
- Thread t = new Thread(r, threadNamePrefix +'-'+ this.threadIndex.incrementAndGet());
+ Thread t = new Thread(r, threadNamePrefix + '-' + this.threadIndex.incrementAndGet());
if (isDaemonSpecified != null) {
t.setDaemon(isDaemonSpecified);
}
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/EventMeshUtil.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/EventMeshUtil.java
similarity index 95%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/EventMeshUtil.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/EventMeshUtil.java
index 560e3c2d1e..3814fb7de5 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/EventMeshUtil.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/EventMeshUtil.java
@@ -15,36 +15,43 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.util;
+package org.apache.eventmesh.runtime.util;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.constants.EventMeshVersion;
-import com.webank.eventmesh.common.ThreadUtil;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+import static org.apache.eventmesh.runtime.util.OMSUtil.isOMSHeader;
+
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TimeZone;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+
import io.openmessaging.api.Message;
+
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.ThreadUtil;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.constants.EventMeshVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.net.UnknownHostException;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-
-import static com.webank.eventmesh.runtime.util.OMSUtil.isOMSHeader;
-
public class EventMeshUtil {
public static Logger logger = LoggerFactory.getLogger(EventMeshUtil.class);
@@ -91,6 +98,7 @@ public static String buildBroadcastClientConsumerGroup(String systemId, String d
public static String buildPersistentClientConsumerGroup(String systemId, String dcn) {
return EventMeshConstants.CONSUMER_GROUP_NAME_PREFIX + systemId + "-" + dcn;
}
+
public static String buildClientGroup(String systemId, String dcn) {
return systemId + "-" + dcn;
}
@@ -290,9 +298,9 @@ public static EventMeshMessage encodeMessage(Message omsMessage) throws Exceptio
if (sysHeaders.containsKey("START_TIME")) {
long deliverTime;
- if (StringUtils.isBlank(sysHeaders.getProperty("START_TIME"))){
+ if (StringUtils.isBlank(sysHeaders.getProperty("START_TIME"))) {
deliverTime = 0;
- }else {
+ } else {
deliverTime = Long.parseLong(sysHeaders.getProperty("START_TIME"));
}
@@ -406,8 +414,8 @@ private static void getIpResult(ArrayList ipv4Result, ArrayList
}
}
- public static String buildUserAgentClientId(UserAgent client){
- if(client == null){
+ public static String buildUserAgentClientId(UserAgent client) {
+ if (client == null) {
return null;
}
StringBuilder sb = new StringBuilder();
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/HttpTinyClient.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/HttpTinyClient.java
similarity index 93%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/HttpTinyClient.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/HttpTinyClient.java
index 121e59e36c..f3a930ca0b 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/HttpTinyClient.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/HttpTinyClient.java
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.util;
-
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
+package org.apache.eventmesh.runtime.util;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -27,10 +25,12 @@
import java.util.Iterator;
import java.util.List;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+
public class HttpTinyClient {
static public HttpResult httpGet(String url, List headers, List paramValues,
- String encoding, long readTimeoutMs) throws IOException {
+ String encoding, long readTimeoutMs) throws IOException {
String encodedContent = encodingParams(paramValues, encoding);
url += (null == encodedContent) ? "" : ("?" + encodedContent);
@@ -60,7 +60,7 @@ static public HttpResult httpGet(String url, List headers, List
}
static private String encodingParams(List paramValues, String encoding)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
if (null == paramValues) {
return null;
@@ -93,7 +93,7 @@ static private void setHeaders(HttpURLConnection conn, List headers, Str
* @return the http response of given http post request
*/
static public HttpResult httpPost(String url, List headers, List paramValues,
- String encoding, long readTimeoutMs) throws IOException {
+ String encoding, long readTimeoutMs) throws IOException {
String encodedContent = encodingParams(paramValues, encoding);
HttpURLConnection conn = null;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/IOTinyUtils.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/IOTinyUtils.java
similarity index 91%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/IOTinyUtils.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/IOTinyUtils.java
index e4d4867d8e..7ce4d154aa 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/IOTinyUtils.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/IOTinyUtils.java
@@ -15,20 +15,30 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.util;
-
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-
-import java.io.*;
+package org.apache.eventmesh.runtime.util;
+
+import java.io.BufferedReader;
+import java.io.CharArrayWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.List;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+
public class IOTinyUtils {
static public String toString(InputStream input, String encoding) throws IOException {
return (null == encoding) ? toString(new InputStreamReader(input, EventMeshConstants.DEFAULT_CHARSET)) : toString(new InputStreamReader(
- input, encoding));
+ input, encoding));
}
static public String toString(Reader reader) throws IOException {
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/OMSUtil.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/OMSUtil.java
similarity index 61%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/OMSUtil.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/OMSUtil.java
index 82927e362b..32e310f84e 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/OMSUtil.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/OMSUtil.java
@@ -1,5 +1,23 @@
+/*
+ * Licensed to Apache Software Foundation (ASF) under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Apache Software Foundation (ASF) licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
-package com.webank.eventmesh.runtime.util;
+package org.apache.eventmesh.runtime.util;
import java.lang.reflect.Field;
import java.util.HashMap;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/RemotingHelper.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/RemotingHelper.java
similarity index 86%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/RemotingHelper.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/RemotingHelper.java
index 942b2ecb11..0266a924dd 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/RemotingHelper.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/RemotingHelper.java
@@ -1,8 +1,28 @@
-package com.webank.eventmesh.runtime.util;
+/*
+ * Licensed to Apache Software Foundation (ASF) under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Apache Software Foundation (ASF) licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.eventmesh.runtime.util;
-import io.netty.channel.Channel;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
+
+import io.netty.channel.Channel;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -12,7 +32,7 @@ public class RemotingHelper {
public static Logger logger = LoggerFactory.getLogger(RemotingHelper.class);
public static String exceptionSimpleDesc(final Throwable e) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (e != null) {
sb.append(e.toString());
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/ServerGlobal.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/ServerGlobal.java
similarity index 96%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/ServerGlobal.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/ServerGlobal.java
index 28541680ee..9ef4422946 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/ServerGlobal.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/ServerGlobal.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.util;
+package org.apache.eventmesh.runtime.util;
import java.util.concurrent.atomic.AtomicLong;
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/Utils.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/Utils.java
similarity index 95%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/Utils.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/Utils.java
index c46253fa8e..f3596e6a74 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/Utils.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/Utils.java
@@ -15,21 +15,23 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.util;
-
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.Session;
-import com.webank.eventmesh.runtime.core.protocol.tcp.client.session.SessionState;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+package org.apache.eventmesh.runtime.util;
+
+import java.util.Map;
+
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
+
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
+import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.SessionState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Map;
public class Utils {
private final static Logger logger = LoggerFactory.getLogger(Utils.class);
diff --git a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/ValueComparator.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/ValueComparator.java
similarity index 96%
rename from eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/ValueComparator.java
rename to eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/ValueComparator.java
index 6e429ccf40..2eb24e57fd 100644
--- a/eventmesh-runtime/src/main/java/com/webank/eventmesh/runtime/util/ValueComparator.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/ValueComparator.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.runtime.util;
+package org.apache.eventmesh.runtime.util;
import java.util.Comparator;
import java.util.Map;
diff --git a/eventmesh-runtime/src/test/java/client/EventMeshClient.java b/eventmesh-runtime/src/test/java/client/EventMeshClient.java
index 9b6c890d81..ce4a13ed4a 100644
--- a/eventmesh-runtime/src/test/java/client/EventMeshClient.java
+++ b/eventmesh-runtime/src/test/java/client/EventMeshClient.java
@@ -17,8 +17,10 @@
package client;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
import client.hook.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+
public interface EventMeshClient {
Package rr(Package msg, long timeout) throws Exception;
diff --git a/eventmesh-runtime/src/test/java/client/PubClient.java b/eventmesh-runtime/src/test/java/client/PubClient.java
index 90c8c57ef2..452279d400 100644
--- a/eventmesh-runtime/src/test/java/client/PubClient.java
+++ b/eventmesh-runtime/src/test/java/client/PubClient.java
@@ -17,9 +17,10 @@
package client;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+
import client.hook.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
public interface PubClient {
diff --git a/eventmesh-runtime/src/test/java/client/SubClient.java b/eventmesh-runtime/src/test/java/client/SubClient.java
index a15ab114f2..dff635ac0d 100644
--- a/eventmesh-runtime/src/test/java/client/SubClient.java
+++ b/eventmesh-runtime/src/test/java/client/SubClient.java
@@ -17,9 +17,10 @@
package client;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+
import client.hook.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
public interface SubClient {
diff --git a/eventmesh-runtime/src/test/java/client/common/ClientGlobal.java b/eventmesh-runtime/src/test/java/client/common/ClientGlobal.java
index 91bf50773f..d4ce76abea 100644
--- a/eventmesh-runtime/src/test/java/client/common/ClientGlobal.java
+++ b/eventmesh-runtime/src/test/java/client/common/ClientGlobal.java
@@ -17,15 +17,16 @@
package client.common;
+import java.util.TimeZone;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.TimeZone;
-
public class ClientGlobal {
diff --git a/eventmesh-runtime/src/test/java/client/common/Codec.java b/eventmesh-runtime/src/test/java/client/common/Codec.java
index ec9026a282..82ffcb0aec 100644
--- a/eventmesh-runtime/src/test/java/client/common/Codec.java
+++ b/eventmesh-runtime/src/test/java/client/common/Codec.java
@@ -17,25 +17,26 @@
package client.common;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.RedirectInfo;
-import com.webank.eventmesh.common.protocol.tcp.Subscription;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+import java.nio.charset.Charset;
+import java.util.Arrays;
+import java.util.List;
+
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.handler.codec.ReplayingDecoder;
+
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.RedirectInfo;
+import org.apache.eventmesh.common.protocol.tcp.Subscription;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.List;
-
public class Codec {
private final static Logger logger = LoggerFactory.getLogger(Codec.class);
diff --git a/eventmesh-runtime/src/test/java/client/common/MessageUtils.java b/eventmesh-runtime/src/test/java/client/common/MessageUtils.java
index 9b10574ab4..0eb313ed3e 100644
--- a/eventmesh-runtime/src/test/java/client/common/MessageUtils.java
+++ b/eventmesh-runtime/src/test/java/client/common/MessageUtils.java
@@ -17,17 +17,17 @@
package client.common;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.Subscription;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.Subscription;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+
public class MessageUtils {
public static int seqLength = 10;
diff --git a/eventmesh-runtime/src/test/java/client/common/RequestContext.java b/eventmesh-runtime/src/test/java/client/common/RequestContext.java
index 149b4b4e0d..2319403490 100644
--- a/eventmesh-runtime/src/test/java/client/common/RequestContext.java
+++ b/eventmesh-runtime/src/test/java/client/common/RequestContext.java
@@ -17,12 +17,12 @@
package client.common;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.eventmesh.common.protocol.tcp.Package;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.CountDownLatch;
-
public class RequestContext {
private static Logger logger = LoggerFactory.getLogger(RequestContext.class);
diff --git a/eventmesh-runtime/src/test/java/client/common/Server.java b/eventmesh-runtime/src/test/java/client/common/Server.java
index 909041c822..85402890fa 100644
--- a/eventmesh-runtime/src/test/java/client/common/Server.java
+++ b/eventmesh-runtime/src/test/java/client/common/Server.java
@@ -17,8 +17,8 @@
package client.common;
-import com.webank.eventmesh.runtime.boot.EventMeshServer;
-import com.webank.eventmesh.runtime.configuration.EventMeshHTTPConfiguration;
+import org.apache.eventmesh.runtime.boot.EventMeshServer;
+import org.apache.eventmesh.runtime.configuration.EventMeshHTTPConfiguration;
public class Server {
diff --git a/eventmesh-runtime/src/test/java/client/common/TCPClient.java b/eventmesh-runtime/src/test/java/client/common/TCPClient.java
index 4a7d30c13f..c0068de8eb 100644
--- a/eventmesh-runtime/src/test/java/client/common/TCPClient.java
+++ b/eventmesh-runtime/src/test/java/client/common/TCPClient.java
@@ -17,7 +17,17 @@
package client.common;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+import java.io.Closeable;
+import java.net.InetSocketAddress;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicInteger;
+
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.AdaptiveRecvByteBufAllocator;
@@ -32,20 +42,11 @@
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
+
+import org.apache.eventmesh.common.protocol.tcp.Package;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.Closeable;
-import java.net.InetSocketAddress;
-import java.util.Random;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicInteger;
-
/**
* 一个Client连一个ACCESS
diff --git a/eventmesh-runtime/src/test/java/client/common/UserAgentUtils.java b/eventmesh-runtime/src/test/java/client/common/UserAgentUtils.java
index 7ba72d6863..eff23f1a9c 100644
--- a/eventmesh-runtime/src/test/java/client/common/UserAgentUtils.java
+++ b/eventmesh-runtime/src/test/java/client/common/UserAgentUtils.java
@@ -17,13 +17,11 @@
package client.common;
-import com.webank.eventmesh.runtime.constants.EventMeshConstants;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-//import org.apache.rocketmq.common.UtilAll;
-//import org.apache.rocketmq.remoting.common.RemotingUtil;
-
import java.util.concurrent.ThreadLocalRandom;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
+
public class UserAgentUtils {
public static UserAgent createPubUserAgent() {
UserAgent userAgent = new UserAgent();
diff --git a/eventmesh-runtime/src/test/java/client/hook/ReceiveMsgHook.java b/eventmesh-runtime/src/test/java/client/hook/ReceiveMsgHook.java
index bd6622c88b..6aca270f46 100644
--- a/eventmesh-runtime/src/test/java/client/hook/ReceiveMsgHook.java
+++ b/eventmesh-runtime/src/test/java/client/hook/ReceiveMsgHook.java
@@ -17,8 +17,10 @@
package client.hook;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
/**
* 业务回调钩子, 这是针对所有类型的消息都会进行的回调
*/
diff --git a/eventmesh-runtime/src/test/java/client/impl/EventMeshClientImpl.java b/eventmesh-runtime/src/test/java/client/impl/EventMeshClientImpl.java
index a0f361d0e8..5f58c1e54f 100644
--- a/eventmesh-runtime/src/test/java/client/impl/EventMeshClientImpl.java
+++ b/eventmesh-runtime/src/test/java/client/impl/EventMeshClientImpl.java
@@ -17,13 +17,14 @@
package client.impl;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+
import client.EventMeshClient;
import client.PubClient;
import client.SubClient;
import client.common.UserAgentUtils;
import client.hook.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
public class EventMeshClientImpl implements EventMeshClient {
protected UserAgent agent;
diff --git a/eventmesh-runtime/src/test/java/client/impl/PubClientImpl.java b/eventmesh-runtime/src/test/java/client/impl/PubClientImpl.java
index 2cb8f3238b..ee01069dc1 100644
--- a/eventmesh-runtime/src/test/java/client/impl/PubClientImpl.java
+++ b/eventmesh-runtime/src/test/java/client/impl/PubClientImpl.java
@@ -17,25 +17,27 @@
package client.impl;
-import client.PubClient;
-import client.common.ClientConstants;
-import client.common.MessageUtils;
-import client.common.RequestContext;
-import client.common.TCPClient;
-import client.hook.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
+
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
+import client.PubClient;
+import client.common.ClientConstants;
+import client.common.MessageUtils;
+import client.common.RequestContext;
+import client.common.TCPClient;
+import client.hook.ReceiveMsgHook;
public class PubClientImpl extends TCPClient implements PubClient {
diff --git a/eventmesh-runtime/src/test/java/client/impl/SubClientImpl.java b/eventmesh-runtime/src/test/java/client/impl/SubClientImpl.java
index 0f578567b1..3a61b48683 100644
--- a/eventmesh-runtime/src/test/java/client/impl/SubClientImpl.java
+++ b/eventmesh-runtime/src/test/java/client/impl/SubClientImpl.java
@@ -17,28 +17,30 @@
package client.impl;
-import client.SubClient;
-import client.common.ClientConstants;
-import client.common.MessageUtils;
-import client.common.RequestContext;
-import client.common.TCPClient;
-import client.hook.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.OPStatus;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
+
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.OPStatus;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
+import client.SubClient;
+import client.common.ClientConstants;
+import client.common.MessageUtils;
+import client.common.RequestContext;
+import client.common.TCPClient;
+import client.hook.ReceiveMsgHook;
public class SubClientImpl extends TCPClient implements SubClient {
diff --git a/eventmesh-runtime/src/test/java/demo/AsyncPubClient.java b/eventmesh-runtime/src/test/java/demo/AsyncPubClient.java
index 115537c4ec..911105a426 100644
--- a/eventmesh-runtime/src/test/java/demo/AsyncPubClient.java
+++ b/eventmesh-runtime/src/test/java/demo/AsyncPubClient.java
@@ -17,14 +17,16 @@
package demo;
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.ThreadUtil;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
import client.common.ClientConstants;
import client.common.MessageUtils;
import client.common.UserAgentUtils;
import client.hook.ReceiveMsgHook;
import client.impl.PubClientImpl;
-import com.webank.eventmesh.common.ThreadUtil;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
public class AsyncPubClient {
public static void main(String[] args) throws Exception {
diff --git a/eventmesh-runtime/src/test/java/demo/AsyncSubClient.java b/eventmesh-runtime/src/test/java/demo/AsyncSubClient.java
index a2f71550b8..eb55d0ec7a 100644
--- a/eventmesh-runtime/src/test/java/demo/AsyncSubClient.java
+++ b/eventmesh-runtime/src/test/java/demo/AsyncSubClient.java
@@ -17,13 +17,15 @@
package demo;
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
import client.common.ClientConstants;
import client.common.MessageUtils;
import client.hook.ReceiveMsgHook;
import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
public class AsyncSubClient {
public static void main(String[] args) throws Exception {
diff --git a/eventmesh-runtime/src/test/java/demo/BroadCastPubClient.java b/eventmesh-runtime/src/test/java/demo/BroadCastPubClient.java
index e0e2841873..637898509f 100644
--- a/eventmesh-runtime/src/test/java/demo/BroadCastPubClient.java
+++ b/eventmesh-runtime/src/test/java/demo/BroadCastPubClient.java
@@ -17,11 +17,12 @@
package demo;
+import org.apache.eventmesh.common.ThreadUtil;
+
import client.common.ClientConstants;
import client.common.MessageUtils;
import client.common.UserAgentUtils;
import client.impl.PubClientImpl;
-import com.webank.eventmesh.common.ThreadUtil;
public class BroadCastPubClient {
public static void main(String[] args) throws Exception {
diff --git a/eventmesh-runtime/src/test/java/demo/BroadCastSubClient.java b/eventmesh-runtime/src/test/java/demo/BroadCastSubClient.java
index dbecf4254b..f3f29f666a 100644
--- a/eventmesh-runtime/src/test/java/demo/BroadCastSubClient.java
+++ b/eventmesh-runtime/src/test/java/demo/BroadCastSubClient.java
@@ -17,14 +17,16 @@
package demo;
+import io.netty.channel.ChannelHandlerContext;
+
+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 client.common.ClientConstants;
import client.common.MessageUtils;
import client.hook.ReceiveMsgHook;
import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
public class BroadCastSubClient {
public static void main(String[] args) throws Exception {
diff --git a/eventmesh-runtime/src/test/java/demo/CCSubClient.java b/eventmesh-runtime/src/test/java/demo/CCSubClient.java
index 6c1e21fef9..d415743cf3 100644
--- a/eventmesh-runtime/src/test/java/demo/CCSubClient.java
+++ b/eventmesh-runtime/src/test/java/demo/CCSubClient.java
@@ -17,13 +17,15 @@
package demo;
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
import client.common.MessageUtils;
import client.common.UserAgentUtils;
import client.hook.ReceiveMsgHook;
import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
public class CCSubClient {
diff --git a/eventmesh-runtime/src/test/java/demo/CClientDemo.java b/eventmesh-runtime/src/test/java/demo/CClientDemo.java
index ebc2a5563f..590aa3fe2c 100644
--- a/eventmesh-runtime/src/test/java/demo/CClientDemo.java
+++ b/eventmesh-runtime/src/test/java/demo/CClientDemo.java
@@ -17,15 +17,17 @@
package demo;
-import client.common.MessageUtils;
-import client.hook.ReceiveMsgHook;
-import client.impl.EventMeshClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Package;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import client.common.MessageUtils;
+import client.hook.ReceiveMsgHook;
+import client.impl.EventMeshClientImpl;
+
/**
* SIMPLE客户端使用样例
*/
diff --git a/eventmesh-runtime/src/test/java/demo/SyncPubClient.java b/eventmesh-runtime/src/test/java/demo/SyncPubClient.java
index ae87df0565..18a032fbc5 100644
--- a/eventmesh-runtime/src/test/java/demo/SyncPubClient.java
+++ b/eventmesh-runtime/src/test/java/demo/SyncPubClient.java
@@ -17,11 +17,12 @@
package demo;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
import client.common.MessageUtils;
import client.common.UserAgentUtils;
import client.impl.PubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Package;
public class SyncPubClient {
public static void main(String[] args) throws Exception {
diff --git a/eventmesh-runtime/src/test/java/demo/SyncSubClient.java b/eventmesh-runtime/src/test/java/demo/SyncSubClient.java
index 50a62adf8b..10e13c4ae8 100644
--- a/eventmesh-runtime/src/test/java/demo/SyncSubClient.java
+++ b/eventmesh-runtime/src/test/java/demo/SyncSubClient.java
@@ -17,13 +17,15 @@
package demo;
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
import client.common.ClientConstants;
import client.common.MessageUtils;
import client.hook.ReceiveMsgHook;
import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
public class SyncSubClient {
public static void main(String[] args) throws Exception {
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdAsync2ClientTest.java b/eventmesh-runtime/src/test/java/protocol/CmdAsync2ClientTest.java
deleted file mode 100644
index 774f1325e0..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdAsync2ClientTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.PubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.hook.ReceiveMsgHook;
-import client.impl.PubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Cmd Test: Async Message To Client
- */
-public class CmdAsync2ClientTest {
-
- public static Server server = new Server();
- public static PubClient client = new PubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_AsyncMessage() throws Exception {
- server.startAccessServer();
- client.init();
- }
-
- @Test
- public void test_Cmd_AsyncMessage() throws Exception {
- client.registerBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- System.err.println("receive response from server:------------------" + msg.toString());
- if (msg.getHeader().getCommand() == Command.CLIENT_GOODBYE_RESPONSE) {
- Assert.assertTrue("HEARTBEAT_RESPONSE", true);
- }
- }
- });
- Package msg = new Package();
- client.publish(msg, 3000);
-// Thread.sleep(10000);
- }
-
- @AfterClass
- public static void after_Cmd_AsyncMessage() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdAsync2ServerTest.java b/eventmesh-runtime/src/test/java/protocol/CmdAsync2ServerTest.java
deleted file mode 100644
index 7c3b1ae979..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdAsync2ServerTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.PubClient;
-import client.common.MessageUtils;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.impl.PubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class CmdAsync2ServerTest {
-
- public static Server server = new Server();
- public static PubClient client = new PubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_AsyncMessage2Server() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @Test
- public void test_Cmd_AsyncMessage2Server() throws Exception {
- Package msg = MessageUtils.asyncMessage("FT0-e-80010000-01-1", 0);
- Package replyMsg = client.publish(msg, 3000);
- System.err.println("Reply Message-----------------------------------------" + replyMsg.toString());
- if (replyMsg.getHeader().getCommand() != Command.ASYNC_MESSAGE_TO_SERVER_ACK) {
- Assert.assertTrue("ASYNC_MESSAGE_TO_SERVER_ACK FAIL", false);
- }
- }
-
- @AfterClass
- public static void after_Cmd_AsyncMessage2Server() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdBroadCast2ClientTest.java b/eventmesh-runtime/src/test/java/protocol/CmdBroadCast2ClientTest.java
deleted file mode 100644
index ddd2afbcfb..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdBroadCast2ClientTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.SubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.hook.ReceiveMsgHook;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Cmd Test: BroadCast To Client
- */
-public class CmdBroadCast2ClientTest {
-
- public static Server server = new Server();
- public static SubClient client = new SubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_broadcast() throws Exception {
- server.startAccessServer();
- client.init();
- }
-
- @Test
- public void test_Cmd_broadcast() throws Exception {
- client.registerBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- System.err.println("receive response from server:------------------" + msg.toString());
- if (msg.getHeader().getCommand() == Command.BROADCAST_MESSAGE_TO_CLIENT) {
- Assert.assertTrue("HEARTBEAT_RESPONSE", true);
- }
- }
- });
- Package msg = new Package();
-// client.publish(msg,3000);
-// Thread.sleep(10000);
- }
-
- @AfterClass
- public static void after_Cmd_broadcast() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdBroadCast2ServerTest.java b/eventmesh-runtime/src/test/java/protocol/CmdBroadCast2ServerTest.java
deleted file mode 100644
index 928a76fed0..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdBroadCast2ServerTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.PubClient;
-import client.common.MessageUtils;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.impl.PubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class CmdBroadCast2ServerTest {
-
- public static Server server = new Server();
- public static PubClient client = new PubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_broadcast2Server() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @Test
- public void test_Cmd_broadcast2Server() throws Exception {
- Package msg = MessageUtils.broadcastMessage("FT0-e-80030000-01-3", 0);
- Package replyMsg = client.broadcast(msg, 3000);
- System.err.println("Reply Message-----------------------------------------" + replyMsg.toString());
- if (replyMsg.getHeader().getCommand() != Command.BROADCAST_MESSAGE_TO_SERVER_ACK) {
- Assert.assertTrue("BROADCAST_MESSAGE_TO_SERVER_ACK FAIL", false);
- }
- }
-
- @AfterClass
- public static void after_Cmd_broadcast2Server() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdClientGoodByTest.java b/eventmesh-runtime/src/test/java/protocol/CmdClientGoodByTest.java
deleted file mode 100644
index b0a3d51de5..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdClientGoodByTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.SubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test Cmd: CLIENT_GOODBYE_REQUEST
- */
-public class CmdClientGoodByTest {
- public static Server server = new Server();
- public static SubClient client = new SubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_client_goodbye() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @Test
- public void test_Cmd_client_goodbye() throws Exception {
- Package replyMsg = client.goodbye();
- System.err.println("Reply Message-----------------------------------------" + replyMsg.toString());
- if (replyMsg.getHeader().getCommand() != Command.CLIENT_GOODBYE_RESPONSE) {
- Assert.assertTrue("CLIENT_GOODBYE_RESPONSE FAIL", false);
- }
- }
-
- @AfterClass
- public static void after_Cmd_client_goodbye() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdHeartbeatTest.java b/eventmesh-runtime/src/test/java/protocol/CmdHeartbeatTest.java
deleted file mode 100644
index 978abbd159..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdHeartbeatTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.PubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.hook.ReceiveMsgHook;
-import client.impl.PubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Cmd Test : HeartBeat
- */
-public class CmdHeartbeatTest {
- public static Server server = new Server();
- public static PubClient client = new PubClientImpl("127.0.0.1", 10000, UserAgentUtils.createPubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_hearbeat() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @Test
- public void test_Cmd_heartbeat() throws Exception {
- client.registerBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- System.err.println("receive response from server:------------------" + msg.toString());
- if (msg.getHeader().getCommand() != Command.HEARTBEAT_RESPONSE) {
- Assert.assertTrue("HEARTBEAT_RESPONSE", false);
- }
- }
- });
- client.heartbeat();
-
- Thread.sleep(10000);
- }
-
- @AfterClass
- public static void after_Cmd_heartbeat() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdListenTest.java b/eventmesh-runtime/src/test/java/protocol/CmdListenTest.java
deleted file mode 100644
index 300bb2b469..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdListenTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.SubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Cmd Test: LISTEN_REQUEST
- */
-public class CmdListenTest {
- public static Server server = new Server();
- public static SubClient client = new SubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_listen() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @AfterClass
- public static void after_Cmd_listen() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-
- @Test
- public void test_Cmd_listen() throws Exception {
- Package replyMsg = client.listen();
- System.err.println("Reply Message-----------------------------------------" + replyMsg.toString());
- if (replyMsg.getHeader().getCommand() != Command.LISTEN_RESPONSE) {
- Assert.assertTrue("SUBSCRIBE_RESPONSE FAIL", false);
- }
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdRecommendTest.java b/eventmesh-runtime/src/test/java/protocol/CmdRecommendTest.java
deleted file mode 100644
index 6973511611..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdRecommendTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.PubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.impl.PubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class CmdRecommendTest {
- public static Server server = new Server();
- public static PubClient client = new PubClientImpl("127.0.0.1", 10000, UserAgentUtils.createPubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_Recommend() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @AfterClass
- public static void after_Cmd_Recommend() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-
- @Test
- public void test_Cmd_Recommend() throws Exception {
-
- Package replyMsg = client.askRecommend();
- System.err.println("Reply Message-----------------------------------------" + replyMsg.toString());
- if (replyMsg.getHeader().getCommand() != Command.RECOMMEND_RESPONSE) {
- Assert.assertTrue("RECOMMEND_RESPONSE FAIL", false);
- }
- }
-
-
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdSendRRTest.java b/eventmesh-runtime/src/test/java/protocol/CmdSendRRTest.java
deleted file mode 100644
index 2516437d96..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdSendRRTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.PubClient;
-import client.SubClient;
-import client.common.MessageUtils;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.impl.PubClientImpl;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class CmdSendRRTest {
-
- public static Server server = new Server();
- public static PubClient client = new PubClientImpl("127.0.0.1", 10000, UserAgentUtils.createPubUserAgent());
- public static SubClient subClient = new SubClientImpl("127.0.0.1", 10000, UserAgentUtils.createUserAgent());
-
- @BeforeClass
- public static void before_Cmd_RR() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @Test
- public void test_Cmd_RR() throws Exception {
- Package msg = MessageUtils.rrMesssage("FT0-s-80000000-01-0", 0);
- Package replyMsg = client.rr(msg, 5000);
- System.err.println("收到回复:" + replyMsg.toString());
- if (replyMsg.getHeader().getCommand() != Command.RESPONSE_TO_CLIENT) {
- Assert.assertTrue("RESPONSE_TO_CLIENT FAIL", false);
- }
- Thread.sleep(1000);
- }
-
- @AfterClass
- public static void after_Cmd_RR() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdSubscribeTest.java b/eventmesh-runtime/src/test/java/protocol/CmdSubscribeTest.java
deleted file mode 100644
index 3d6a3b2e3f..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdSubscribeTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.SubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-/**
- * Test Cmd: SUBSCRIBE_REQUEST
- */
-public class CmdSubscribeTest {
-
- public static Server server = new Server();
- public static SubClient client = new SubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_subscribe() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @AfterClass
- public static void after_Cmd_subscribe() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-
- @Test
- public void test_Cmd_subscribe() throws Exception {
- Package replyMsg = client.justSubscribe("FT0-s-80000000-01-0");
- System.err.println("Reply Message------------------" + replyMsg.toString());
- if (replyMsg.getHeader().getCommand() != Command.SUBSCRIBE_RESPONSE) {
- Assert.assertTrue("SUBSCRIBE_RESPONSE FAIL", false);
- }
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdSysLogTest.java b/eventmesh-runtime/src/test/java/protocol/CmdSysLogTest.java
deleted file mode 100644
index caf8fce570..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdSysLogTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.SubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.hook.ReceiveMsgHook;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test Cmd: SYS_LOG_TO_LOGSERVER
- */
-public class CmdSysLogTest {
- public static Server server = new Server();
- public static SubClient client = new SubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_syslog() throws Exception {
- server.startAccessServer();
- client.init();
- }
-
- @AfterClass
- public static void after_Cmd_syslog() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-
- @Test
- public void test_Cmd_syslog() throws Exception {
- client.registerBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- System.err.println("receive response from server:------------------" + msg.toString());
- Assert.assertTrue("receive a error command", false);
- }
- });
-// client.sysLog();
- Thread.sleep(1000);
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdTraceLogTest.java b/eventmesh-runtime/src/test/java/protocol/CmdTraceLogTest.java
deleted file mode 100644
index 7255adc3a6..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdTraceLogTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.SubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.hook.ReceiveMsgHook;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Cmd Test: TRACE_LOG_TO_LOGSERVER
- */
-public class CmdTraceLogTest {
-
- public static Server server = new Server();
- public static SubClient client = new SubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_traceLog() throws Exception {
- server.startAccessServer();
- client.init();
- }
-
- @AfterClass
- public static void after_Cmd_traceLog() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-
- @Test
- public void test_Cmd_traceLog() throws Exception {
- client.registerBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- System.err.println("receive response from server:------------------" + msg.toString());
- Assert.assertTrue("receive a error command", false);
- }
- });
-// client.traceLog();
- Thread.sleep(1000);
- }
-}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdUnSubscribeTest.java b/eventmesh-runtime/src/test/java/protocol/CmdUnSubscribeTest.java
deleted file mode 100644
index 4210655195..0000000000
--- a/eventmesh-runtime/src/test/java/protocol/CmdUnSubscribeTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package protocol;
-
-import client.SubClient;
-import client.common.Server;
-import client.common.UserAgentUtils;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test Cmd: UNSUBSCRIBE_REQUEST
- */
-public class CmdUnSubscribeTest {
-
- public static Server server = new Server();
- public static SubClient client = new SubClientImpl("127.0.0.1", 10000, UserAgentUtils.createSubUserAgent());
-
- @BeforeClass
- public static void before_Cmd_unsubscribe() throws Exception {
- server.startAccessServer();
- client.init();
- Thread.sleep(1000);
- }
-
- @AfterClass
- public static void after_Cmd_unsubscribe() throws Exception {
-// server.shutdownAccessServer();
-// client.close();
- }
-
- @Test
- public void test_Cmd_unsubscribe() throws Exception {
- Package replyMsg = client.justUnsubscribe("FT0-s-80000000-01-0");
- System.err.println("Reply Message-----------------------------------------" + replyMsg.toString());
- if (replyMsg.getHeader().getCommand() != Command.UNSUBSCRIBE_RESPONSE) {
- Assert.assertTrue("UNSUBSCRIBE_RESPONSE FAIL", false);
- }
- }
-}
diff --git a/eventmesh-runtime/src/test/java/test/BasicTest.java b/eventmesh-runtime/src/test/java/test/BasicTest.java
deleted file mode 100644
index a95d3d4f6c..0000000000
--- a/eventmesh-runtime/src/test/java/test/BasicTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package test;
-
-import client.EventMeshClient;
-import client.PubClient;
-import client.SubClient;
-import client.common.MessageUtils;
-import client.hook.ReceiveMsgHook;
-import client.impl.EventMeshClientImpl;
-import client.impl.PubClientImpl;
-import client.impl.SubClientImpl;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import io.netty.channel.ChannelHandlerContext;
-import org.junit.Test;
-
-public class BasicTest {
- @Test
- public void helloTest() throws Exception {
- EventMeshClient client = initClient();
- client.heartbeat();
- client.close();
- }
-
- @Test
- public void heartbeatTest() throws Exception {
- EventMeshClient client = initClient();
- client.heartbeat();
- Thread.sleep(4000);
- client.close();
- }
-
- @Test
- public void goodbyeTest() throws Exception {
- EventMeshClient client = initClient();
- client.heartbeat();
- client.goodbye();
- client.close();
- }
-
- @Test
- public void subscribe() throws Exception {
- EventMeshClient client = initClient();
- client.heartbeat();
- client.justSubscribe("FT0-s-80010000-01-1");
- client.close();
- }
-
- @Test
- public void unsubscribe() throws Exception {
- EventMeshClient client = initClient();
- client.heartbeat();
- client.justSubscribe("FT0-s-80000000-01-0");
- client.listen();
- client.justUnsubscribe("FT0-s-80000000-01-0");
- client.close();
- }
-
- @Test
- public void listenTest() throws Exception {
- EventMeshClient client = initClient();
- client.heartbeat();
- client.listen();
- client.close();
- }
-
- @Test
- public void syncMessage() throws Exception {
- EventMeshClient client = initClient();
- client.heartbeat();
- client.justSubscribe("FT0-s-80000000-01-0");
- client.listen();
- for (int i = 0; i < 100; i++) {
- Package rr = client.rr(MessageUtils.rrMesssage("FT0-s-80000000-01-0", i), 3000);
- if (rr.getBody() instanceof EventMeshMessage) {
- String body = ((EventMeshMessage) rr.getBody()).getBody();
- System.err.println("rrMessage: " + body + " " + "rr-reply-------------------------------------------------" + rr.toString());
- }
- }
- Thread.sleep(100);
- client.close();
- }
-
- @Test
- public void asyncMessage() throws Exception {
- EventMeshClient client = initClient();
-
- client.justSubscribe("FT0-e-80010000-01-1");
- client.heartbeat();
- client.listen();
- client.registerSubBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- if (msg.getBody() instanceof EventMeshMessage) {
- String body = ((EventMeshMessage) msg.getBody()).getBody();
- System.err.println("receive message :------" + body + "------------------------------------------------" + msg.toString());
- }
- }
- });
- System.err.println("before publish");
- client.publish(MessageUtils.asyncMessage("FT0-e-80010000-01-1", 0), 3000);
- Thread.sleep(500);
- client.close();
- }
-
- @Test
- public void broadcastMessage() throws Exception {
- EventMeshClient client = initClient();
- client.heartbeat();
- client.justSubscribe("FT0-e-80030000-01-3");
- client.listen();
- client.registerSubBusiHandler(new ReceiveMsgHook() {
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- if (msg.getBody() instanceof EventMeshMessage) {
- String body = ((EventMeshMessage) msg.getBody()).getBody();
- System.err.println("receive message: ------------" + body + "-------------------------------" + msg.toString());
- }
- }
- });
- client.broadcast(MessageUtils.broadcastMessage("FT0-e-80030000-01-3", 0), 3000);
- Thread.sleep(500);
- client.close();
- }
-
- private PubClient initPubClient() throws Exception {
- PubClientImpl pubClient = new PubClientImpl("127.0.0.1", 10000, MessageUtils.generatePubClient());
- pubClient.init();
- return pubClient;
- }
-
- private SubClient initSubClient() throws Exception {
- SubClientImpl subClient = new SubClientImpl("127.0.0.1", 10000, MessageUtils.generateSubServer());
- subClient.init();
- return subClient;
- }
-
- private EventMeshClient initClient() throws Exception {
- EventMeshClientImpl client = new EventMeshClientImpl("127.0.0.1", 10000);
- client.init();
- return client;
- }
-}
diff --git a/eventmesh-sdk-java/build.gradle b/eventmesh-sdk-java/build.gradle
index fe66fd0d53..70a51362e6 100644
--- a/eventmesh-sdk-java/build.gradle
+++ b/eventmesh-sdk-java/build.gradle
@@ -21,52 +21,14 @@
//}
-apply plugin: 'java'
-apply plugin: "maven"
-apply plugin: "eclipse"
-apply plugin: "idea"
+//ext['commons-pool2.version'] = '2.6.1'
-if (project.findProperty("jdk") == "1.7") {
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
-} else {
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
- version = version + "-jdk8"
-}
-
-if (project.findProperty("snapshot") instanceof String) {
- if (project.property("snapshot").toBoolean()) version = version + "-SNAPSHOT"
-}
-
-repositories {
- mavenLocal()
- maven {
- url "https://maven.aliyun.com/repository/public"
- }
- mavenCentral()
-}
-
-ext['commons-pool2.version'] = '2.6.1'
-
-List log4j2 = [
- "org.apache.logging.log4j:log4j-api:2.13.3",
- "org.apache.logging.log4j:log4j-core:2.13.3",
- "org.apache.logging.log4j:log4j-slf4j-impl:2.13.3",
- "org.apache.logging.log4j:log4j-web:2.13.3",
- "com.lmax:disruptor:3.4.2"
-]
-
-List sl4j = [
- "org.slf4j:slf4j-api:1.7.30"
-]
-
dependencies {
- compile log4j2, sl4j
- testCompile log4j2, sl4j
- compile project(":eventmesh-common")
- testCompile project(":eventmesh-common")
+ //implementation log4j2, sl4j,httpclient,netty
+ // log4j2, sl4j,httpclient,netty
+ implementation project(":eventmesh-common")
+ testImplementation project(":eventmesh-common")
// //Spring依赖的第三方模块(2.1.6依赖的是3.8.1)
// compile("org.apache.commons:commons-lang3")
@@ -84,43 +46,3 @@ dependencies {
// }
}
-configurations.all{
- exclude group: "ch.qos.logback"
-}
-
-//uploadArchives {
-// repositories {
-// mavenDeployer {
-//// snapshotRepository(url: 'Your target repo address') {
-//// authentication(userName: 'Your user name', password: 'Your password')
-//// }
-//// repository(url: 'Your target repo address') {
-//// authentication(userName: 'Your user name', password: 'Your password')
-//// }
-// }
-// }
-//}
-
-task zip(type: Zip, dependsOn: ['clean', 'jar']) {
- extension = 'zip'
- archiveName = project.name + '_' + version + '.' + extension
- destinationDir = new File(projectDir, 'dist')
-
- into("/") {
- from project.jar.getArchivePath()
- }
-}
-
-task tar(type: Tar, dependsOn: ['clean', 'jar']) {
- extension = 'tar.gz'
- compression = Compression.GZIP
- archiveName = project.name + '_' + version + '.' + extension
- destinationDir = new File(projectDir, 'dist')
- into("/") {
- from project.jar.getArchivePath()
- }
-}
-
-tasks.withType(JavaCompile) {
- options.encoding = "UTF-8"
-}
\ No newline at end of file
diff --git a/eventmesh-sdk-java/gradle.properties b/eventmesh-sdk-java/gradle.properties
index 0b0cdce4c5..d0503c3b7b 100644
--- a/eventmesh-sdk-java/gradle.properties
+++ b/eventmesh-sdk-java/gradle.properties
@@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
-group=com.webank.eventmesh
+group=org.apache.eventmesh
version=1.2.0-SNAPSHOT
jdk=1.8
snapshot=false
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/AbstractLiteClient.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/AbstractLiteClient.java
similarity index 92%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/AbstractLiteClient.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/AbstractLiteClient.java
index 9b8e04dc14..261fbb423c 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/AbstractLiteClient.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/AbstractLiteClient.java
@@ -15,21 +15,22 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http;
+package org.apache.eventmesh.client.http;
+
+import java.util.Arrays;
+import java.util.List;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.common.EventMeshException;
import com.google.common.collect.Lists;
+
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.common.EventMeshException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Arrays;
-import java.util.List;
-
public abstract class AbstractLiteClient {
public Logger logger = LoggerFactory.getLogger(AbstractLiteClient.class);
@@ -52,7 +53,7 @@ public AbstractLiteClient(LiteClientConfig liteClientConfig) {
public void start() throws Exception {
eventMeshServerList = process(liteClientConfig.getLiteEventMeshAddr());
- if(eventMeshServerList == null || eventMeshServerList.size() < 1){
+ if (eventMeshServerList == null || eventMeshServerList.size() < 1) {
throw new EventMeshException("liteEventMeshAddr param illegal,please check");
}
}
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/EventMeshRetObj.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/EventMeshRetObj.java
similarity index 96%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/EventMeshRetObj.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/EventMeshRetObj.java
index 21a295e424..fe024fcf5f 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/EventMeshRetObj.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/EventMeshRetObj.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http;
+package org.apache.eventmesh.client.http;
public class EventMeshRetObj {
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/RemotingServer.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/RemotingServer.java
similarity index 89%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/RemotingServer.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/RemotingServer.java
index a8c4683d36..e85937e9ef 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/RemotingServer.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/RemotingServer.java
@@ -15,47 +15,66 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http;
-import com.webank.eventmesh.client.http.consumer.HandleResult;
-import com.webank.eventmesh.client.http.consumer.context.LiteConsumeContext;
-import com.webank.eventmesh.client.http.consumer.listener.LiteMessageListener;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.common.IPUtil;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.ThreadUtil;
-import com.webank.eventmesh.common.command.HttpCommand;
-import com.webank.eventmesh.common.protocol.http.body.Body;
-import com.webank.eventmesh.common.protocol.http.body.message.PushMessageRequestBody;
-import com.webank.eventmesh.common.protocol.http.common.ClientRetCode;
-import com.webank.eventmesh.common.protocol.http.common.ProtocolKey;
-import com.webank.eventmesh.common.protocol.http.common.ProtocolVersion;
-import com.webank.eventmesh.common.protocol.http.common.RequestCode;
-import com.webank.eventmesh.common.protocol.http.header.Header;
-import com.webank.eventmesh.common.protocol.http.header.message.PushMessageRequestHeader;
+package org.apache.eventmesh.client.http;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
import io.netty.bootstrap.ServerBootstrap;
-import io.netty.channel.*;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
-import io.netty.handler.codec.http.*;
+import io.netty.handler.codec.http.DefaultFullHttpResponse;
+import io.netty.handler.codec.http.FullHttpResponse;
+import io.netty.handler.codec.http.HttpHeaderNames;
+import io.netty.handler.codec.http.HttpHeaderValues;
+import io.netty.handler.codec.http.HttpMethod;
+import io.netty.handler.codec.http.HttpObjectAggregator;
+import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.HttpRequestDecoder;
+import io.netty.handler.codec.http.HttpResponseEncoder;
+import io.netty.handler.codec.http.HttpResponseStatus;
+import io.netty.handler.codec.http.HttpVersion;
+import io.netty.handler.codec.http.QueryStringDecoder;
import io.netty.handler.codec.http.multipart.Attribute;
import io.netty.handler.codec.http.multipart.DefaultHttpDataFactory;
import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder;
import io.netty.handler.codec.http.multipart.InterfaceHttpData;
+
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.consumer.HandleResult;
+import org.apache.eventmesh.client.http.consumer.context.LiteConsumeContext;
+import org.apache.eventmesh.client.http.consumer.listener.LiteMessageListener;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.IPUtil;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.ThreadUtil;
+import org.apache.eventmesh.common.command.HttpCommand;
+import org.apache.eventmesh.common.protocol.http.body.Body;
+import org.apache.eventmesh.common.protocol.http.body.message.PushMessageRequestBody;
+import org.apache.eventmesh.common.protocol.http.common.ClientRetCode;
+import org.apache.eventmesh.common.protocol.http.common.ProtocolKey;
+import org.apache.eventmesh.common.protocol.http.common.ProtocolVersion;
+import org.apache.eventmesh.common.protocol.http.common.RequestCode;
+import org.apache.eventmesh.common.protocol.http.header.Header;
+import org.apache.eventmesh.common.protocol.http.header.message.PushMessageRequestHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
public class RemotingServer {
public Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -138,9 +157,6 @@ public String getEndpointURL() {
}
-
-
-
class HTTPHandler extends SimpleChannelInboundHandler {
/**
@@ -213,7 +229,7 @@ protected void channelRead0(final ChannelHandlerContext ctx, HttpRequest httpReq
if (StringUtils.isBlank(requestCode)
|| !StringUtils.isNumeric(requestCode)
|| (!String.valueOf(RequestCode.HTTP_PUSH_CLIENT_ASYNC.getRequestCode()).equals(requestCode)
- && !String.valueOf(RequestCode.HTTP_PUSH_CLIENT_SYNC.getRequestCode()).equals(requestCode))) {
+ && !String.valueOf(RequestCode.HTTP_PUSH_CLIENT_SYNC.getRequestCode()).equals(requestCode))) {
logger.error("receive invalid requestCode, {}", requestCode);
responseCommand = requestCommand.createHttpCommandResponse(ClientRetCode.OK.getRetCode(), ClientRetCode.OK.getErrMsg());
sendResponse(ctx, responseCommand.httpResponse());
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/conf/LiteClientConfig.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/conf/LiteClientConfig.java
similarity index 98%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/conf/LiteClientConfig.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/conf/LiteClientConfig.java
index 23febec8ee..21140b2ab8 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/conf/LiteClientConfig.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/conf/LiteClientConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.conf;
+package org.apache.eventmesh.client.http.conf;
public class LiteClientConfig {
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/HandleResult.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/HandleResult.java
similarity index 94%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/HandleResult.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/HandleResult.java
index 0b88101989..c5a9a85bd3 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/HandleResult.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/HandleResult.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.consumer;
+package org.apache.eventmesh.client.http.consumer;
public enum HandleResult {
OK,
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/LiteConsumer.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/LiteConsumer.java
similarity index 90%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/LiteConsumer.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/LiteConsumer.java
index 8fe0950dbe..801481a418 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/LiteConsumer.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/LiteConsumer.java
@@ -15,42 +15,48 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.consumer;
+package org.apache.eventmesh.client.http.consumer;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
-import com.webank.eventmesh.client.http.AbstractLiteClient;
-import com.webank.eventmesh.client.http.EventMeshRetObj;
-import com.webank.eventmesh.client.http.RemotingServer;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.consumer.listener.LiteMessageListener;
-import com.webank.eventmesh.client.http.http.HttpUtil;
-import com.webank.eventmesh.client.http.http.RequestParam;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.client.tcp.common.EventMeshThreadFactoryImpl;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.common.EventMeshException;
-import com.webank.eventmesh.common.ThreadPoolFactory;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
-import com.webank.eventmesh.common.protocol.http.body.client.HeartbeatRequestBody;
-import com.webank.eventmesh.common.protocol.http.body.client.SubscribeRequestBody;
-import com.webank.eventmesh.common.protocol.http.common.*;
+
import io.netty.handler.codec.http.HttpMethod;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.RandomUtils;
+import org.apache.eventmesh.client.http.AbstractLiteClient;
+import org.apache.eventmesh.client.http.EventMeshRetObj;
+import org.apache.eventmesh.client.http.RemotingServer;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.consumer.listener.LiteMessageListener;
+import org.apache.eventmesh.client.http.http.HttpUtil;
+import org.apache.eventmesh.client.http.http.RequestParam;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.common.EventMeshThreadFactoryImpl;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.EventMeshException;
+import org.apache.eventmesh.common.ThreadPoolFactory;
+import org.apache.eventmesh.common.protocol.http.body.client.HeartbeatRequestBody;
+import org.apache.eventmesh.common.protocol.http.body.client.SubscribeRequestBody;
+import org.apache.eventmesh.common.protocol.http.common.ClientType;
+import org.apache.eventmesh.common.protocol.http.common.EventMeshRetCode;
+import org.apache.eventmesh.common.protocol.http.common.ProtocolKey;
+import org.apache.eventmesh.common.protocol.http.common.ProtocolVersion;
+import org.apache.eventmesh.common.protocol.http.common.RequestCode;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
public class LiteConsumer extends AbstractLiteClient {
public Logger logger = LoggerFactory.getLogger(LiteConsumer.class);
@@ -111,7 +117,7 @@ public void shutdown() throws Exception {
public boolean subscribe(List topicList, String url) throws Exception {
subscription.addAll(topicList);
- if(!started.get()) {
+ if (!started.get()) {
start();
}
@@ -129,7 +135,7 @@ public boolean subscribe(List topicList, String url) throws Exception {
throw new EventMeshException(ex);
}
- if(logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled()) {
logger.debug("subscribe message by await, targetEventMesh:{}, cost:{}ms, subscribeParam:{}, rtn:{}", target, System.currentTimeMillis() - startTime, JSON.toJSONString(subscribeParam), subRes);
}
@@ -169,7 +175,7 @@ private RequestParam generateSubscribeRequestParam(List topicList, Strin
private RequestParam generateHeartBeatRequestParam(List topics, String url) {
List heartbeatEntities = new ArrayList<>();
- for (String topic : topics){
+ for (String topic : topics) {
HeartbeatRequestBody.HeartbeatEntity heartbeatEntity = new HeartbeatRequestBody.HeartbeatEntity();
heartbeatEntity.topic = topic;
heartbeatEntity.url = url;
@@ -200,7 +206,7 @@ public void heartBeat(List topicList, String url) throws Exception {
@Override
public void run() {
try {
- if(!started.get()) {
+ if (!started.get()) {
start();
}
RequestParam requestParam = generateHeartBeatRequestParam(topicList, url);
@@ -214,7 +220,7 @@ public void run() {
throw new EventMeshException(ex);
}
- if(logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled()) {
logger.debug("heartBeat message by await, targetEventMesh:{}, cost:{}ms, rtn:{}", target, System.currentTimeMillis() - startTime, res);
}
@@ -247,7 +253,7 @@ public boolean unsubscribe(List topicList, String url) throws EventMeshE
throw new EventMeshException(ex);
}
- if(logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled()) {
logger.debug("unSubscribe message by await, targetEventMesh:{}, cost:{}ms, unSubscribeParam:{}, rtn:{}", target, System.currentTimeMillis() - startTime, JSON.toJSONString(unSubscribeParam), unSubRes);
}
@@ -289,9 +295,9 @@ public String selectEventMesh() {
if (CollectionUtils.isEmpty(eventMeshServerList)) {
return null;
}
- if(liteClientConfig.isUseTls()){
+ if (liteClientConfig.isUseTls()) {
return Constants.HTTPS_PROTOCOL_PREFIX + eventMeshServerList.get(RandomUtils.nextInt(0, eventMeshServerList.size()));
- }else{
+ } else {
return Constants.HTTP_PROTOCOL_PREFIX + eventMeshServerList.get(RandomUtils.nextInt(0, eventMeshServerList.size()));
}
}
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/context/LiteConsumeContext.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/context/LiteConsumeContext.java
similarity index 95%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/context/LiteConsumeContext.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/context/LiteConsumeContext.java
index 0157a24090..42739ca0a9 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/context/LiteConsumeContext.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/context/LiteConsumeContext.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.consumer.context;
+package org.apache.eventmesh.client.http.consumer.context;
-import com.webank.eventmesh.common.Constants;
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.common.Constants;
public class LiteConsumeContext {
@@ -40,7 +40,7 @@ public class LiteConsumeContext {
private long createTime = System.currentTimeMillis();
public LiteConsumeContext(String eventMeshIp, String eventMeshEnv,
- String eventMeshIdc,String eventMeshRegion,
+ String eventMeshIdc, String eventMeshRegion,
String eventMeshCluster, String eventMeshDcn) {
this.eventMeshIp = eventMeshIp;
this.eventMeshEnv = eventMeshEnv;
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/listener/LiteMessageListener.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/listener/LiteMessageListener.java
similarity index 80%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/listener/LiteMessageListener.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/listener/LiteMessageListener.java
index 3e2aa367d8..c7f5ac99af 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/consumer/listener/LiteMessageListener.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/listener/LiteMessageListener.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.consumer.listener;
+package org.apache.eventmesh.client.http.consumer.listener;
-import com.webank.eventmesh.client.http.consumer.HandleResult;
-import com.webank.eventmesh.client.http.consumer.context.LiteConsumeContext;
-import com.webank.eventmesh.common.LiteMessage;
+
+import org.apache.eventmesh.client.http.consumer.HandleResult;
+import org.apache.eventmesh.client.http.consumer.context.LiteConsumeContext;
+import org.apache.eventmesh.common.LiteMessage;
public interface LiteMessageListener {
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/http/HttpUtil.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/http/HttpUtil.java
similarity index 98%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/http/HttpUtil.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/http/HttpUtil.java
index 7340ca81ba..4093a89ea1 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/http/HttpUtil.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/http/HttpUtil.java
@@ -15,12 +15,23 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.http;
-import com.webank.eventmesh.common.Constants;
+package org.apache.eventmesh.client.http.http;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
import com.google.common.base.Preconditions;
+
import io.netty.handler.codec.http.HttpMethod;
+
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.common.Constants;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
@@ -35,14 +46,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
public class HttpUtil {
public static Logger logger = LoggerFactory.getLogger(HttpUtil.class);
@@ -133,7 +136,7 @@ public static void post(CloseableHttpClient client,
.setConnectTimeout(Integer.parseInt(String.valueOf(requestParam.getTimeout())))
.setConnectionRequestTimeout(Integer.parseInt(String.valueOf(requestParam.getTimeout())));
- if(forwardAgent != null) {
+ if (forwardAgent != null) {
configBuilder.setProxy(forwardAgent);
}
@@ -176,7 +179,7 @@ public static void get(CloseableHttpClient client,
.setConnectTimeout(Integer.parseInt(String.valueOf(requestParam.getTimeout())))
.setConnectionRequestTimeout(Integer.parseInt(String.valueOf(requestParam.getTimeout())));
- if(forwardAgent != null) {
+ if (forwardAgent != null) {
configBuilder.setProxy(forwardAgent);
}
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/http/RequestParam.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/http/RequestParam.java
similarity index 98%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/http/RequestParam.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/http/RequestParam.java
index ce03e0be51..4d23222352 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/http/RequestParam.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/http/RequestParam.java
@@ -15,11 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.http;
-
-import io.netty.handler.codec.http.HttpMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.eventmesh.client.http.http;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@@ -27,6 +23,11 @@
import java.util.HashMap;
import java.util.Map;
+import io.netty.handler.codec.http.HttpMethod;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class RequestParam {
public Logger logger = LoggerFactory.getLogger(this.getClass());
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/LiteProducer.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/LiteProducer.java
similarity index 88%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/LiteProducer.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/LiteProducer.java
index 460a39c536..3b4ecc2384 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/LiteProducer.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/LiteProducer.java
@@ -15,43 +15,48 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.producer;
+package org.apache.eventmesh.client.http.producer;
+
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+
-import com.webank.eventmesh.client.http.AbstractLiteClient;
-import com.webank.eventmesh.client.http.EventMeshRetObj;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.http.HttpUtil;
-import com.webank.eventmesh.client.http.http.RequestParam;
-import com.webank.eventmesh.client.http.ssl.MyX509TrustManager;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.EventMeshException;
-import com.webank.eventmesh.common.protocol.http.body.message.SendMessageRequestBody;
-import com.webank.eventmesh.common.protocol.http.body.message.SendMessageResponseBody;
-import com.webank.eventmesh.common.protocol.http.common.ProtocolKey;
-import com.webank.eventmesh.common.protocol.http.common.ProtocolVersion;
-import com.webank.eventmesh.common.protocol.http.common.EventMeshRetCode;
-import com.webank.eventmesh.common.protocol.http.common.RequestCode;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Preconditions;
+
import io.netty.handler.codec.http.HttpMethod;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.AbstractLiteClient;
+import org.apache.eventmesh.client.http.EventMeshRetObj;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.http.HttpUtil;
+import org.apache.eventmesh.client.http.http.RequestParam;
+import org.apache.eventmesh.client.http.ssl.MyX509TrustManager;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.EventMeshException;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.protocol.http.body.message.SendMessageRequestBody;
+import org.apache.eventmesh.common.protocol.http.body.message.SendMessageResponseBody;
+import org.apache.eventmesh.common.protocol.http.common.EventMeshRetCode;
+import org.apache.eventmesh.common.protocol.http.common.ProtocolKey;
+import org.apache.eventmesh.common.protocol.http.common.ProtocolVersion;
+import org.apache.eventmesh.common.protocol.http.common.RequestCode;
+import org.apache.http.conn.ssl.DefaultHostnameVerifier;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-
public class LiteProducer extends AbstractLiteClient {
public Logger logger = LoggerFactory.getLogger(LiteProducer.class);
@@ -60,7 +65,7 @@ public class LiteProducer extends AbstractLiteClient {
public LiteProducer(LiteClientConfig liteClientConfig) {
super(liteClientConfig);
- if(liteClientConfig.isUseTls()){
+ if (liteClientConfig.isUseTls()) {
setHttpClient();
}
}
@@ -71,7 +76,7 @@ public LiteProducer(LiteClientConfig liteClientConfig) {
public void start() throws Exception {
Preconditions.checkState(liteClientConfig != null, "liteClientConfig can't be null");
Preconditions.checkState(liteClientConfig.getLiteEventMeshAddr() != null, "liteClientConfig.liteServerAddr can't be null");
- if(started.get()) {
+ if (started.get()) {
return;
}
logger.info("LiteProducer starting");
@@ -82,7 +87,7 @@ public void start() throws Exception {
@Override
public void shutdown() throws Exception {
- if(!started.get()) {
+ if (!started.get()) {
return;
}
logger.info("LiteProducer shutting down");
@@ -133,7 +138,7 @@ public boolean publish(LiteMessage message) throws Exception {
throw new EventMeshException(ex);
}
- if(logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled()) {
logger.debug("publish async message, targetEventMesh:{}, cost:{}ms, message:{}, rtn:{}",
target, System.currentTimeMillis() - startTime, message, res);
}
@@ -151,15 +156,15 @@ public String selectEventMesh() {
if (CollectionUtils.isEmpty(eventMeshServerList)) {
return null;
}
- if(liteClientConfig.isUseTls()){
+ if (liteClientConfig.isUseTls()) {
return Constants.HTTPS_PROTOCOL_PREFIX + eventMeshServerList.get(RandomUtils.nextInt(0, eventMeshServerList.size()));
- }else{
+ } else {
return Constants.HTTP_PROTOCOL_PREFIX + eventMeshServerList.get(RandomUtils.nextInt(0, eventMeshServerList.size()));
}
}
public LiteMessage request(LiteMessage message, long timeout) throws Exception {
- if(!started.get()) {
+ if (!started.get()) {
start();
}
Preconditions.checkState(StringUtils.isNotBlank(message.getTopic()),
@@ -195,7 +200,7 @@ public LiteMessage request(LiteMessage message, long timeout) throws Exception {
throw new EventMeshException(ex);
}
- if(logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled()) {
logger.debug("publish sync message by await, targetEventMesh:{}, cost:{}ms, message:{}, rtn:{}", target, System.currentTimeMillis() - startTime, message, res);
}
@@ -213,7 +218,7 @@ public LiteMessage request(LiteMessage message, long timeout) throws Exception {
}
public void request(LiteMessage message, RRCallback rrCallback, long timeout) throws Exception {
- if(!started.get()) {
+ if (!started.get()) {
start();
}
Preconditions.checkState(StringUtils.isNotBlank(message.getTopic()),
@@ -250,7 +255,7 @@ public void request(LiteMessage message, RRCallback rrCallback, long timeout) th
throw new EventMeshException(ex);
}
- if(logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled()) {
logger.debug("publish sync message by async, target:{}, cost:{}, message:{}", target, System.currentTimeMillis() - startTime, message);
}
}
@@ -259,11 +264,11 @@ public static void setHttpClient() {
SSLContext sslContext = null;
try {
String protocol = System.getProperty("ssl.client.protocol", "TLSv1.1");
- TrustManager[] tm = new TrustManager[] { new MyX509TrustManager() };
+ TrustManager[] tm = new TrustManager[]{new MyX509TrustManager()};
sslContext = SSLContext.getInstance(protocol);
sslContext.init(null, tm, new SecureRandom());
- httpClient = HttpClients.custom().setSslcontext(sslContext)
- .setHostnameVerifier(SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER).build();
+ httpClient = HttpClients.custom().setSSLContext(sslContext)
+ .setSSLHostnameVerifier(new DefaultHostnameVerifier()).build();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/RRCallback.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/RRCallback.java
similarity index 90%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/RRCallback.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/RRCallback.java
index 53fbaea84c..c5187984de 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/RRCallback.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/RRCallback.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.producer;
+package org.apache.eventmesh.client.http.producer;
-import com.webank.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.LiteMessage;
public interface RRCallback {
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/RRCallbackResponseHandlerAdapter.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/RRCallbackResponseHandlerAdapter.java
similarity index 90%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/RRCallbackResponseHandlerAdapter.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/RRCallbackResponseHandlerAdapter.java
index 846fa1531e..aba948bc32 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/producer/RRCallbackResponseHandlerAdapter.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/RRCallbackResponseHandlerAdapter.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.http.producer;
-
-import com.webank.eventmesh.client.http.EventMeshRetObj;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.EventMeshException;
-import com.webank.eventmesh.common.protocol.http.body.message.SendMessageResponseBody;
-import com.webank.eventmesh.common.protocol.http.common.EventMeshRetCode;
+package org.apache.eventmesh.client.http.producer;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+
import com.alibaba.fastjson.JSON;
+
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.eventmesh.client.http.EventMeshRetObj;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.EventMeshException;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.protocol.http.body.message.SendMessageResponseBody;
+import org.apache.eventmesh.common.protocol.http.common.EventMeshRetCode;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
@@ -33,9 +38,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.nio.charset.Charset;
-
public class RRCallbackResponseHandlerAdapter implements ResponseHandler {
public Logger logger = LoggerFactory.getLogger(RRCallbackResponseHandlerAdapter.class);
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/ssl/MyX509TrustManager.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/ssl/MyX509TrustManager.java
similarity index 68%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/ssl/MyX509TrustManager.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/ssl/MyX509TrustManager.java
index 8576f57aaa..6128b38fd0 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/http/ssl/MyX509TrustManager.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/ssl/MyX509TrustManager.java
@@ -1,6 +1,22 @@
-package com.webank.eventmesh.client.http.ssl;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.http.ssl;
-import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -12,15 +28,18 @@
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
+
+import org.apache.commons.lang3.StringUtils;
+
public class MyX509TrustManager implements X509TrustManager {
X509TrustManager myTrustManager;
public MyX509TrustManager() throws Exception {
KeyStore keyStore = KeyStore.getInstance("JKS");
- String fileName = System.getProperty("ssl.client.cer","sChat2.jks");
+ String fileName = System.getProperty("ssl.client.cer", "sChat2.jks");
String pass = System.getProperty("ssl.client.pass", "sNetty");
char[] filePass = null;
- if(StringUtils.isNotBlank(pass)){
+ if (StringUtils.isNotBlank(pass)) {
filePass = pass.toCharArray();
}
keyStore.load(Files.newInputStream(Paths.get(System.getProperty("confPath", System.getenv("confPath"))
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/EventMeshClient.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/EventMeshClient.java
similarity index 87%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/EventMeshClient.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/EventMeshClient.java
index e98925e45a..4e11260528 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/EventMeshClient.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/EventMeshClient.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp;
+package org.apache.eventmesh.client.tcp;
-import com.webank.eventmesh.client.tcp.common.AsyncRRCallback;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.client.tcp.common.AsyncRRCallback;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.common.protocol.tcp.Package;
public interface EventMeshClient {
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/SimplePubClient.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/SimplePubClient.java
similarity index 82%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/SimplePubClient.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/SimplePubClient.java
index 072b121b91..239cfa423d 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/SimplePubClient.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/SimplePubClient.java
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp;
+package org.apache.eventmesh.client.tcp;
-import com.webank.eventmesh.client.tcp.common.AsyncRRCallback;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.client.tcp.common.AsyncRRCallback;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
public interface SimplePubClient {
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/SimpleSubClient.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/SimpleSubClient.java
similarity index 61%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/SimpleSubClient.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/SimpleSubClient.java
index 04b1006994..251fd93b27 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/SimpleSubClient.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/SimpleSubClient.java
@@ -15,28 +15,28 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp;
+package org.apache.eventmesh.client.tcp;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
public interface SimpleSubClient {
- void init() throws Exception;
+ void init() throws Exception;
- void close();
+ void close();
- void heartbeat() throws Exception;
+ void heartbeat() throws Exception;
- void reconnect() throws Exception;
+ void reconnect() throws Exception;
- void subscribe(String topic) throws Exception;
+ void subscribe(String topic) throws Exception;
- void unsubscribe() throws Exception;
+ void unsubscribe() throws Exception;
- void listen() throws Exception;
+ void listen() throws Exception;
- void registerBusiHandler(ReceiveMsgHook handler) throws Exception;
+ void registerBusiHandler(ReceiveMsgHook handler) throws Exception;
- UserAgent getUserAgent();
+ UserAgent getUserAgent();
}
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/AsyncRRCallback.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/AsyncRRCallback.java
similarity index 89%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/AsyncRRCallback.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/AsyncRRCallback.java
index 39621f58bd..135e88dd88 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/AsyncRRCallback.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/AsyncRRCallback.java
@@ -15,8 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.common;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+package org.apache.eventmesh.client.tcp.common;
public interface AsyncRRCallback {
void callback(Package msg);
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/EventMeshCommon.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/EventMeshCommon.java
similarity index 98%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/EventMeshCommon.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/EventMeshCommon.java
index 2d9d8a9c00..65aa40e918 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/EventMeshCommon.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/EventMeshCommon.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.common;
+package org.apache.eventmesh.client.tcp.common;
public class EventMeshCommon {
/**
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/EventMeshThreadFactoryImpl.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/EventMeshThreadFactoryImpl.java
similarity index 92%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/EventMeshThreadFactoryImpl.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/EventMeshThreadFactoryImpl.java
index 89ab987087..49692baa92 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/EventMeshThreadFactoryImpl.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/EventMeshThreadFactoryImpl.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.common;
+package org.apache.eventmesh.client.tcp.common;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
@@ -40,7 +40,7 @@ public String getThreadNamePrefix() {
@Override
public Thread newThread(Runnable r) {
- Thread t = new Thread(r, threadNamePrefix +'-'+ this.threadIndex.incrementAndGet());
+ Thread t = new Thread(r, threadNamePrefix + '-' + this.threadIndex.incrementAndGet());
if (isDaemonSpecified != null) {
t.setDaemon(isDaemonSpecified);
}
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/MessageUtils.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/MessageUtils.java
similarity index 93%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/MessageUtils.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/MessageUtils.java
index 261deaa3e5..4122a234a0 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/MessageUtils.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/MessageUtils.java
@@ -15,17 +15,18 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.common;
+package org.apache.eventmesh.client.tcp.common;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.Subscription;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.common.protocol.tcp.Package;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.Subscription;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
public class MessageUtils {
private static final int seqLength = 10;
@@ -145,4 +146,3 @@ private static String generateRandomString(int length) {
return builder.toString();
}
}
-
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/ReceiveMsgHook.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/ReceiveMsgHook.java
similarity index 90%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/ReceiveMsgHook.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/ReceiveMsgHook.java
index 24e8a92e15..bc60a6a8a2 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/ReceiveMsgHook.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/ReceiveMsgHook.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.common;
+package org.apache.eventmesh.client.tcp.common;
import io.netty.channel.ChannelHandlerContext;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.Package;
public interface ReceiveMsgHook {
void handle(Package msg, ChannelHandlerContext ctx);
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/RequestContext.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/RequestContext.java
similarity index 96%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/RequestContext.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/RequestContext.java
index d58dc32781..ae36e6a746 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/RequestContext.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/RequestContext.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.common;
+package org.apache.eventmesh.client.tcp.common;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.eventmesh.common.protocol.tcp.Package;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import java.util.concurrent.CountDownLatch;
public class RequestContext {
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/TcpClient.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/TcpClient.java
similarity index 83%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/TcpClient.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/TcpClient.java
index 252855c19d..7df1e29f30 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/common/TcpClient.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/TcpClient.java
@@ -15,23 +15,39 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.common;
+package org.apache.eventmesh.client.tcp.common;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
-import com.webank.eventmesh.common.protocol.tcp.codec.Codec;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.PooledByteBufAllocator;
-import io.netty.channel.*;
+import io.netty.channel.AdaptiveRecvByteBufAllocator;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelDuplexHandler;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
+
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.codec.Codec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import java.io.Closeable;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Random;
-import java.util.concurrent.*;
public abstract class TcpClient implements Closeable {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -53,7 +69,7 @@ public abstract class TcpClient implements Closeable {
private ScheduledFuture> task;
- public TcpClient(String host, int port){
+ public TcpClient(String host, int port) {
this.host = host;
this.port = port;
}
@@ -130,7 +146,7 @@ private ChannelDuplexHandler newExceptionHandler() {
return new ChannelDuplexHandler() {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
- logger.info("exceptionCaught, close connection.|remote address={}",ctx.channel().remoteAddress(),cause);
+ logger.info("exceptionCaught, close connection.|remote address={}", ctx.channel().remoteAddress(), cause);
ctx.close();
}
};
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/DefaultEventMeshClient.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/DefaultEventMeshClient.java
similarity index 87%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/DefaultEventMeshClient.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/DefaultEventMeshClient.java
index c7b2080ee9..4cc14eb46a 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/DefaultEventMeshClient.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/DefaultEventMeshClient.java
@@ -15,17 +15,17 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.impl;
+package org.apache.eventmesh.client.tcp.impl;
-import com.webank.eventmesh.client.tcp.SimplePubClient;
-import com.webank.eventmesh.client.tcp.SimpleSubClient;
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.AsyncRRCallback;
-import com.webank.eventmesh.client.tcp.common.MessageUtils;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.SimplePubClient;
+import org.apache.eventmesh.client.tcp.SimpleSubClient;
+import org.apache.eventmesh.client.tcp.common.AsyncRRCallback;
+import org.apache.eventmesh.client.tcp.common.MessageUtils;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
public class DefaultEventMeshClient implements EventMeshClient {
protected UserAgent agent;
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/SimplePubClientImpl.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/SimplePubClientImpl.java
similarity index 90%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/SimplePubClientImpl.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/SimplePubClientImpl.java
index ba732c5124..da5691a79f 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/SimplePubClientImpl.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/SimplePubClientImpl.java
@@ -15,28 +15,30 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.impl;
-
-import com.webank.eventmesh.client.tcp.SimplePubClient;
-import com.webank.eventmesh.client.tcp.common.AsyncRRCallback;
-import com.webank.eventmesh.client.tcp.common.MessageUtils;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.client.tcp.common.RequestContext;
-import com.webank.eventmesh.client.tcp.common.TcpClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+package org.apache.eventmesh.client.tcp.impl;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
+
+import org.apache.eventmesh.client.tcp.SimplePubClient;
+import org.apache.eventmesh.client.tcp.common.AsyncRRCallback;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.common.MessageUtils;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.common.RequestContext;
+import org.apache.eventmesh.client.tcp.common.TcpClient;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-
public class SimplePubClientImpl extends TcpClient implements SimplePubClient {
private Logger logger = LoggerFactory.getLogger(this.getClass());
diff --git a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/SimpleSubClientImpl.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/SimpleSubClientImpl.java
similarity index 91%
rename from eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/SimpleSubClientImpl.java
rename to eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/SimpleSubClientImpl.java
index 51ca21f31e..0579184156 100644
--- a/eventmesh-sdk-java/src/main/java/com/webank/eventmesh/client/tcp/impl/SimpleSubClientImpl.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/SimpleSubClientImpl.java
@@ -15,29 +15,31 @@
* limitations under the License.
*/
-package com.webank.eventmesh.client.tcp.impl;
-
-import com.webank.eventmesh.client.tcp.SimpleSubClient;
-import com.webank.eventmesh.client.tcp.common.MessageUtils;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.client.tcp.common.RequestContext;
-import com.webank.eventmesh.client.tcp.common.TcpClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+package org.apache.eventmesh.client.tcp.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
+
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.eventmesh.client.tcp.SimpleSubClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.common.MessageUtils;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.common.RequestContext;
+import org.apache.eventmesh.client.tcp.common.TcpClient;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-
public class SimpleSubClientImpl extends TcpClient implements SimpleSubClient {
private Logger logger = LoggerFactory.getLogger(this.getClass());
diff --git a/eventmesh-sdk-java/src/main/resources/log4j2.xml b/eventmesh-sdk-java/src/main/resources/log4j2.xml
index e3f037b9cb..90f56982b0 100644
--- a/eventmesh-sdk-java/src/main/resources/log4j2.xml
+++ b/eventmesh-sdk-java/src/main/resources/log4j2.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/common/EventMeshTestCaseTopicSet.java b/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/common/EventMeshTestCaseTopicSet.java
deleted file mode 100644
index 2699be30cb..0000000000
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/common/EventMeshTestCaseTopicSet.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.webank.eventmesh.client.tcp.common;
-
-/**
- * Testcase set
- */
-public class EventMeshTestCaseTopicSet {
-
-// public static final String TOPIC_PRX_WQ2ClientBroadCast = "topic-broadcast-test";
- public static final String TOPIC_PRX_WQ2ClientBroadCast = "FT0-e-80030001-01-3";
-
-// public static final String TOPIC_PRX_SyncSubscribeTest = "topic-sync-test";
- public static final String TOPIC_PRX_SyncSubscribeTest = "FT0-s-80000000-01-0";
-
-// public static final String TOPIC_PRX_WQ2ClientUniCast = "topic-async-test";
- public static final String TOPIC_PRX_WQ2ClientUniCast = "FT0-e-80010000-01-1";
-
-}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncPublish.java b/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncPublish.java
deleted file mode 100644
index 009c5f6de4..0000000000
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncPublish.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.webank.eventmesh.client.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AsyncPublish{
-
- public static Logger logger = LoggerFactory.getLogger(AsyncPublish.class);
-
- private static EventMeshClient client;
-
- public static AsyncPublish handler = new AsyncPublish();
-
- public static void main(String[] agrs)throws Exception{
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient1();
- client = new DefaultEventMeshClient("127.0.0.1",10002,userAgent);
- client.init();
- client.heartbeat();
-
- for(int i=0; i < 5; i++) {
- Package asyncMsg = EventMeshTestUtils.asyncMessage();
- logger.info("begin send async msg[{}]==================={}", i, asyncMsg);
- client.publish(asyncMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
-
- Thread.sleep(1000);
- }
-
- Thread.sleep(2000);
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("AsyncPublish failed", e);
- }
- }
-}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncPublishBroadcast.java b/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncPublishBroadcast.java
deleted file mode 100644
index fb2c45e088..0000000000
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncPublishBroadcast.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.webank.eventmesh.client.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AsyncPublishBroadcast {
-
- public static Logger logger = LoggerFactory.getLogger(AsyncPublishBroadcast.class);
-
- private static EventMeshClient client;
-
- public static void main(String[] agrs)throws Exception{
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient1();
- client = new DefaultEventMeshClient("127.0.0.1",10002,userAgent);
- client.init();
- client.heartbeat();
-
- Package broadcastMsg = EventMeshTestUtils.broadcastMessage();
- logger.info("begin send broadcast msg============={}", broadcastMsg);
- client.broadcast(broadcastMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
-
- Thread.sleep(2000);
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("AsyncPublishBroadcast failed", e);
- }
- }
-}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncSubscribe.java b/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncSubscribe.java
deleted file mode 100644
index 1dd980cfc7..0000000000
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncSubscribe.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.webank.eventmesh.client.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import io.netty.channel.ChannelHandlerContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AsyncSubscribe implements ReceiveMsgHook {
-
- public static Logger logger = LoggerFactory.getLogger(AsyncSubscribe.class);
-
- private static EventMeshClient client;
-
- public static AsyncSubscribe handler = new AsyncSubscribe();
-
- public static void main(String[] agrs)throws Exception{
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient2();
- client = new DefaultEventMeshClient("127.0.0.1",10002,userAgent);
- client.init();
- client.heartbeat();
-
- client.subscribe("FT0-e-80010000-01-1");
- client.registerSubBusiHandler(handler);
-
- client.listen();
-
- //client.unsubscribe();
-
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("AsyncSubscribe failed", e);
- }
- }
-
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- EventMeshMessage eventMeshMessage = (EventMeshMessage)msg.getBody();
- logger.info("receive async msg====================={}", eventMeshMessage);
- }
-}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncSubscribeBroadcast.java b/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncSubscribeBroadcast.java
deleted file mode 100644
index bb4fb56f93..0000000000
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/AsyncSubscribeBroadcast.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.webank.eventmesh.client.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import io.netty.channel.ChannelHandlerContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AsyncSubscribeBroadcast implements ReceiveMsgHook {
-
- public static Logger logger = LoggerFactory.getLogger(AsyncSubscribeBroadcast.class);
-
- private static EventMeshClient client;
-
- public static AsyncSubscribeBroadcast handler = new AsyncSubscribeBroadcast();
-
- public static void main(String[] agrs)throws Exception{
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient2();
- client = new DefaultEventMeshClient("127.0.0.1",10002,userAgent);
- client.init();
- client.heartbeat();
-
- client.subscribe("FT0-e-80030001-01-3");
- client.registerSubBusiHandler(handler);
-
- client.listen();
-
- //client.unsubscribe();
-
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("AsyncSubscribeBroadcast failed", e);
- }
- }
-
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- EventMeshMessage eventMeshMessage = (EventMeshMessage)msg.getBody();
- logger.info("receive broadcast msg==============={}", eventMeshMessage);
- }
-}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/SyncRequest.java b/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/SyncRequest.java
deleted file mode 100644
index ad84b1405d..0000000000
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/SyncRequest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.webank.eventmesh.client.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SyncRequest {
-
- public static Logger logger = LoggerFactory.getLogger(SyncRequest.class);
-
- private static EventMeshClient client;
-
- public static void main(String[] agrs)throws Exception{
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient1();
- client = new DefaultEventMeshClient("127.0.0.1",10000,userAgent);
- client.init();
- client.heartbeat();
-
- Package rrMsg = EventMeshTestUtils.syncRR();
- logger.info("begin send rr msg=================={}",rrMsg);
- Package response = client.rr(rrMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
- logger.info("receive rr reply==================={}",response);
-
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("SyncRequest failed", e);
- }
- }
-}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/SyncResponse.java b/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/SyncResponse.java
deleted file mode 100644
index fac84e9390..0000000000
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/demo/SyncResponse.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.webank.eventmesh.client.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import io.netty.channel.ChannelHandlerContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SyncResponse implements ReceiveMsgHook {
-
- public static Logger logger = LoggerFactory.getLogger(SyncResponse.class);
-
- private static EventMeshClient client;
-
- public static SyncResponse handler = new SyncResponse();
-
- public static void main(String[] agrs)throws Exception{
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient2();
- client = new DefaultEventMeshClient("127.0.0.1",10000,userAgent);
- client.init();
- client.heartbeat();
-
- client.subscribe("FT0-s-80000000-01-0");
- //同步RR消息
- client.registerSubBusiHandler(handler);
-
- client.listen();
-
- //client.unsubscribe();
-
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("SyncResponse failed", e);
- }
- }
-
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- logger.info("receive sync rr msg================{}", msg);
- Package pkg = EventMeshTestUtils.rrResponse(msg);
- ctx.writeAndFlush(pkg);
- }
-}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/AsyncPublishInstance.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncPublishInstance.java
similarity index 61%
rename from eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/AsyncPublishInstance.java
rename to eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncPublishInstance.java
index 7722fc0fe0..9eaf745742 100644
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/AsyncPublishInstance.java
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncPublishInstance.java
@@ -1,12 +1,30 @@
-package com.webank.eventmesh.client.http.demo;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.producer.LiteProducer;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.common.IPUtil;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.ThreadUtil;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.http.demo;
+
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.producer.LiteProducer;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.IPUtil;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.ThreadUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -17,7 +35,7 @@ public class AsyncPublishInstance {
public static void main(String[] args) throws Exception {
LiteProducer liteProducer = null;
- try{
+ try {
// String eventMeshIPPort = args[0];
String eventMeshIPPort = "";
// final String topic = args[1];
@@ -38,7 +56,7 @@ public static void main(String[] args) throws Exception {
liteProducer = new LiteProducer(eventMeshClientConfig);
liteProducer.start();
- for(int i = 0; i < 1; i++) {
+ for (int i = 0; i < 1; i++) {
LiteMessage liteMessage = new LiteMessage();
liteMessage.setBizSeqNo(RandomStringUtils.randomNumeric(30))
// .setContent("contentStr with special protocal")
@@ -51,16 +69,16 @@ public static void main(String[] args) throws Exception {
Thread.sleep(1000);
logger.info("publish result , {}", flag);
}
- }catch (Exception e){
+ } catch (Exception e) {
logger.warn("publish msg failed", e);
}
- try{
+ try {
Thread.sleep(30000);
- if(liteProducer != null){
+ if (liteProducer != null) {
liteProducer.shutdown();
}
- }catch (Exception e1){
+ } catch (Exception e1) {
logger.warn("producer shutdown exception", e1);
}
}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/AsyncSyncRequestInstance.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncSyncRequestInstance.java
similarity index 65%
rename from eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/AsyncSyncRequestInstance.java
rename to eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncSyncRequestInstance.java
index c61cfd7096..a03618595e 100644
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/AsyncSyncRequestInstance.java
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncSyncRequestInstance.java
@@ -1,12 +1,31 @@
-package com.webank.eventmesh.client.http.demo;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.producer.LiteProducer;
-import com.webank.eventmesh.client.http.producer.RRCallback;
-import com.webank.eventmesh.common.IPUtil;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.ThreadUtil;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.http.demo;
+
+
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.producer.LiteProducer;
+import org.apache.eventmesh.client.http.producer.RRCallback;
+import org.apache.eventmesh.common.IPUtil;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.ThreadUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,12 +81,12 @@ public void onException(Throwable e) {
logger.warn("async send msg failed", e);
}
- try{
+ try {
Thread.sleep(30000);
- if(liteProducer != null){
+ if (liteProducer != null) {
liteProducer.shutdown();
}
- }catch (Exception e1){
+ } catch (Exception e1) {
logger.warn("producer shutdown exception", e1);
}
}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/SyncRequestInstance.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/SyncRequestInstance.java
similarity index 63%
rename from eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/SyncRequestInstance.java
rename to eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/SyncRequestInstance.java
index 9be5cad16b..22e3f40a61 100644
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/SyncRequestInstance.java
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/SyncRequestInstance.java
@@ -1,11 +1,29 @@
-package com.webank.eventmesh.http.demo;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.producer.LiteProducer;
-import com.webank.eventmesh.common.IPUtil;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.ThreadUtil;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.http.demo;
+
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.producer.LiteProducer;
+import org.apache.eventmesh.common.IPUtil;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.ThreadUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,12 +71,12 @@ public static void main(String[] args) throws Exception {
logger.warn("send msg failed", e);
}
- try{
+ try {
Thread.sleep(30000);
- if(liteProducer != null){
+ if (liteProducer != null) {
liteProducer.shutdown();
}
- }catch (Exception e1){
+ } catch (Exception e1) {
logger.warn("producer shutdown exception", e1);
}
}
diff --git a/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/common/EventMeshTestCaseTopicSet.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/common/EventMeshTestCaseTopicSet.java
new file mode 100644
index 0000000000..171b3d9e10
--- /dev/null
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/common/EventMeshTestCaseTopicSet.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.tcp.common;
+
+/**
+ * Testcase set
+ */
+public class EventMeshTestCaseTopicSet {
+
+ // public static final String TOPIC_PRX_WQ2ClientBroadCast = "topic-broadcast-test";
+ public static final String TOPIC_PRX_WQ2ClientBroadCast = "FT0-e-80030001-01-3";
+
+ // public static final String TOPIC_PRX_SyncSubscribeTest = "topic-sync-test";
+ public static final String TOPIC_PRX_SyncSubscribeTest = "FT0-s-80000000-01-0";
+
+ // public static final String TOPIC_PRX_WQ2ClientUniCast = "topic-async-test";
+ public static final String TOPIC_PRX_WQ2ClientUniCast = "FT0-e-80010000-01-1";
+
+}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/common/EventMeshTestUtils.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/common/EventMeshTestUtils.java
similarity index 74%
rename from eventmesh-test/src/main/java/com/webank/eventmesh/tcp/common/EventMeshTestUtils.java
rename to eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/common/EventMeshTestUtils.java
index b413fbc471..a34f523788 100644
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/common/EventMeshTestUtils.java
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/common/EventMeshTestUtils.java
@@ -1,12 +1,38 @@
-package com.webank.eventmesh.tcp.common;
-
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.*;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.tcp.common;
+
+import static org.apache.eventmesh.client.tcp.common.EventMeshTestCaseTopicSet.TOPIC_PRX_SyncSubscribeTest;
+import static org.apache.eventmesh.client.tcp.common.EventMeshTestCaseTopicSet.TOPIC_PRX_WQ2ClientBroadCast;
+import static org.apache.eventmesh.client.tcp.common.EventMeshTestCaseTopicSet.TOPIC_PRX_WQ2ClientUniCast;
import java.util.concurrent.ThreadLocalRandom;
-import static com.webank.eventmesh.tcp.common.EventMeshTestCaseTopicSet.*;
-import static com.webank.eventmesh.common.protocol.tcp.Command.RESPONSE_TO_SERVER;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.RESPONSE_TO_SERVER;
+
+
+
public class EventMeshTestUtils {
private static final int seqLength = 10;
diff --git a/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncPublish.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncPublish.java
new file mode 100644
index 0000000000..4768127176
--- /dev/null
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncPublish.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.tcp.demo;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncPublish {
+
+ public static Logger logger = LoggerFactory.getLogger(AsyncPublish.class);
+
+ private static EventMeshClient client;
+
+ public static AsyncPublish handler = new AsyncPublish();
+
+ public static void main(String[] agrs) throws Exception {
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient1();
+ client = new DefaultEventMeshClient("127.0.0.1", 10002, userAgent);
+ client.init();
+ client.heartbeat();
+
+ for (int i = 0; i < 5; i++) {
+ Package asyncMsg = EventMeshTestUtils.asyncMessage();
+ logger.info("begin send async msg[{}]==================={}", i, asyncMsg);
+ client.publish(asyncMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
+
+ Thread.sleep(1000);
+ }
+
+ Thread.sleep(2000);
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("AsyncPublish failed", e);
+ }
+ }
+}
diff --git a/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncPublishBroadcast.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncPublishBroadcast.java
new file mode 100644
index 0000000000..a4d527fc12
--- /dev/null
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncPublishBroadcast.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.tcp.demo;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncPublishBroadcast {
+
+ public static Logger logger = LoggerFactory.getLogger(AsyncPublishBroadcast.class);
+
+ private static EventMeshClient client;
+
+ public static void main(String[] agrs) throws Exception {
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient1();
+ client = new DefaultEventMeshClient("127.0.0.1", 10002, userAgent);
+ client.init();
+ client.heartbeat();
+
+ Package broadcastMsg = EventMeshTestUtils.broadcastMessage();
+ logger.info("begin send broadcast msg============={}", broadcastMsg);
+ client.broadcast(broadcastMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
+
+ Thread.sleep(2000);
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("AsyncPublishBroadcast failed", e);
+ }
+ }
+}
diff --git a/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncSubscribe.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncSubscribe.java
new file mode 100644
index 0000000000..319e428772
--- /dev/null
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncSubscribe.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.tcp.demo;
+
+
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncSubscribe implements ReceiveMsgHook {
+
+ public static Logger logger = LoggerFactory.getLogger(AsyncSubscribe.class);
+
+ private static EventMeshClient client;
+
+ public static AsyncSubscribe handler = new AsyncSubscribe();
+
+ public static void main(String[] agrs) throws Exception {
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient2();
+ client = new DefaultEventMeshClient("127.0.0.1", 10002, userAgent);
+ client.init();
+ client.heartbeat();
+
+ client.subscribe("FT0-e-80010000-01-1");
+ client.registerSubBusiHandler(handler);
+
+ client.listen();
+
+ //client.unsubscribe();
+
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("AsyncSubscribe failed", e);
+ }
+ }
+
+ @Override
+ public void handle(Package msg, ChannelHandlerContext ctx) {
+ EventMeshMessage eventMeshMessage = (EventMeshMessage) msg.getBody();
+ logger.info("receive async msg====================={}", eventMeshMessage);
+ }
+}
diff --git a/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncSubscribeBroadcast.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncSubscribeBroadcast.java
new file mode 100644
index 0000000000..8b77e1a3a9
--- /dev/null
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/AsyncSubscribeBroadcast.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.tcp.demo;
+
+
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncSubscribeBroadcast implements ReceiveMsgHook {
+
+ public static Logger logger = LoggerFactory.getLogger(AsyncSubscribeBroadcast.class);
+
+ private static EventMeshClient client;
+
+ public static AsyncSubscribeBroadcast handler = new AsyncSubscribeBroadcast();
+
+ public static void main(String[] agrs) throws Exception {
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient2();
+ client = new DefaultEventMeshClient("127.0.0.1", 10002, userAgent);
+ client.init();
+ client.heartbeat();
+
+ client.subscribe("FT0-e-80030001-01-3");
+ client.registerSubBusiHandler(handler);
+
+ client.listen();
+
+ //client.unsubscribe();
+
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("AsyncSubscribeBroadcast failed", e);
+ }
+ }
+
+ @Override
+ public void handle(Package msg, ChannelHandlerContext ctx) {
+ EventMeshMessage eventMeshMessage = (EventMeshMessage) msg.getBody();
+ logger.info("receive broadcast msg==============={}", eventMeshMessage);
+ }
+}
diff --git a/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/SyncRequest.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/SyncRequest.java
new file mode 100644
index 0000000000..c4c14f5c0d
--- /dev/null
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/SyncRequest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.tcp.demo;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SyncRequest {
+
+ public static Logger logger = LoggerFactory.getLogger(SyncRequest.class);
+
+ private static EventMeshClient client;
+
+ public static void main(String[] agrs) throws Exception {
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient1();
+ client = new DefaultEventMeshClient("127.0.0.1", 10000, userAgent);
+ client.init();
+ client.heartbeat();
+
+ Package rrMsg = EventMeshTestUtils.syncRR();
+ logger.info("begin send rr msg=================={}", rrMsg);
+ Package response = client.rr(rrMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
+ logger.info("receive rr reply==================={}", response);
+
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("SyncRequest failed", e);
+ }
+ }
+}
diff --git a/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/SyncResponse.java b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/SyncResponse.java
new file mode 100644
index 0000000000..b4fbbf71af
--- /dev/null
+++ b/eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/tcp/demo/SyncResponse.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.client.tcp.demo;
+
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SyncResponse implements ReceiveMsgHook {
+
+ public static Logger logger = LoggerFactory.getLogger(SyncResponse.class);
+
+ private static EventMeshClient client;
+
+ public static SyncResponse handler = new SyncResponse();
+
+ public static void main(String[] agrs) throws Exception {
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient2();
+ client = new DefaultEventMeshClient("127.0.0.1", 10000, userAgent);
+ client.init();
+ client.heartbeat();
+
+ client.subscribe("FT0-s-80000000-01-0");
+ //同步RR消息
+ client.registerSubBusiHandler(handler);
+
+ client.listen();
+
+ //client.unsubscribe();
+
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("SyncResponse failed", e);
+ }
+ }
+
+ @Override
+ public void handle(Package msg, ChannelHandlerContext ctx) {
+ logger.info("receive sync rr msg================{}", msg);
+ Package pkg = EventMeshTestUtils.rrResponse(msg);
+ ctx.writeAndFlush(pkg);
+ }
+}
diff --git a/eventmesh-sdk-java/src/test/resources/application.properties b/eventmesh-sdk-java/src/test/resources/application.properties
index 2338e474b6..8bc9ce9a40 100644
--- a/eventmesh-sdk-java/src/test/resources/application.properties
+++ b/eventmesh-sdk-java/src/test/resources/application.properties
@@ -1 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
server.port=8088
\ No newline at end of file
diff --git a/eventmesh-sdk-java/src/test/resources/log4j2.xml b/eventmesh-sdk-java/src/test/resources/log4j2.xml
index 99f79985fb..4297021f90 100644
--- a/eventmesh-sdk-java/src/test/resources/log4j2.xml
+++ b/eventmesh-sdk-java/src/test/resources/log4j2.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/eventmesh-starter/build.gradle b/eventmesh-starter/build.gradle
index 71fad83d98..7b81c6bf08 100644
--- a/eventmesh-starter/build.gradle
+++ b/eventmesh-starter/build.gradle
@@ -1,14 +1,22 @@
-plugins {
- id 'java'
-}
-
-sourceCompatibility = 1.8
-
-repositories {
- mavenCentral()
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
dependencies {
- compile project(":eventmesh-runtime"), project(":eventmesh-connector-rocketmq")
- testCompile group: 'junit', name: 'junit', version: '4.12'
+ implementation project(":eventmesh-runtime"), project(":eventmesh-connector-rocketmq")
+ testImplementation project(":eventmesh-runtime"), project(":eventmesh-connector-rocketmq")
+ //testImplementation group: 'junit', name: 'junit', version: '4.12'
}
\ No newline at end of file
diff --git a/eventmesh-starter/gradle.properties b/eventmesh-starter/gradle.properties
index b0d1e599ec..60d084498a 100644
--- a/eventmesh-starter/gradle.properties
+++ b/eventmesh-starter/gradle.properties
@@ -14,9 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
-group=com.webank.eventmesh
+group=org.apache.eventmesh
version=1.2.0-SNAPSHOT
-defibus_version=1.0.1
mavenUserName=
mavenPassword=
diff --git a/eventmesh-starter/src/main/java/com/webank/eventmesh/starter/StartUp.java b/eventmesh-starter/src/main/java/com/webank/eventmesh/starter/StartUp.java
deleted file mode 100644
index 3771f27b21..0000000000
--- a/eventmesh-starter/src/main/java/com/webank/eventmesh/starter/StartUp.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.webank.eventmesh.starter;
-
-import com.webank.eventmesh.runtime.boot.EventMeshStartup;
-
-public class StartUp {
- public static void main(String[] args) throws Exception {
- EventMeshStartup.main(args);
- }
-}
diff --git a/eventmesh-starter/src/main/java/org/apache/eventmesh/starter/StartUp.java b/eventmesh-starter/src/main/java/org/apache/eventmesh/starter/StartUp.java
new file mode 100644
index 0000000000..4a2ab9d5ac
--- /dev/null
+++ b/eventmesh-starter/src/main/java/org/apache/eventmesh/starter/StartUp.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.starter;
+
+import org.apache.eventmesh.runtime.boot.EventMeshStartup;
+
+public class StartUp {
+ public static void main(String[] args) throws Exception {
+ EventMeshStartup.main(args);
+ }
+}
diff --git a/eventmesh-test/bin/http_pub.sh b/eventmesh-test/bin/http_pub.sh
index b6f07f7826..5c34d0bc31 100644
--- a/eventmesh-test/bin/http_pub.sh
+++ b/eventmesh-test/bin/http_pub.sh
@@ -1,18 +1,21 @@
#!/bin/sh
-
-
-# Copyright (C) @2017 Webank Group Holding Limited
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
-# in compliance with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
#
-# Unless required by applicable law or agreed to in writing, software distributed under the License
-# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-# or implied. See the License for the specific language governing permissions and limitations under
-# the License.
+# http://www.apache.org/licenses/LICENSE-2.0
#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
#===========================================================================================
# Java Environment Setting
@@ -43,13 +46,13 @@ function get_pid {
else
if [[ $OS =~ Msys ]]; then
# 在Msys上存在可能无法kill识别出的进程的BUG
- ppid=`jps -v | grep -i "com.webank.eventmesh.http.demo.AsyncPublishInstance" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ ppid=`jps -v | grep -i "org.apache.eventmesh.http.demo.AsyncPublishInstance" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
elif [[ $OS =~ Darwin ]]; then
# 已知问题:grep java 可能无法精确识别java进程
- ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "com.webank.eventmesh.http.demo.AsyncPublishInstance" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.http.demo.AsyncPublishInstance" | grep -Ev "^root" |awk -F ' ' {'print $2'})
else
#在Linux服务器上要求尽可能精确识别进程
- ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "com.webank.eventmesh.http.demo.AsyncPublishInstance" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "org.apache.eventmesh.http.demo.AsyncPublishInstance" | grep -Ev "^root" |awk -F ' ' {'print $2'})
fi
fi
echo "$ppid";
@@ -124,7 +127,7 @@ make_logs_dir
echo "using jdk[$JAVA]" >> ${DEMO_LOG_HOME}/demo_http_pub.out
-DEMO_MAIN=com.webank.eventmesh.http.demo.AsyncPublishInstance
+DEMO_MAIN=org.apache.eventmesh.http.demo.AsyncPublishInstance
if [ $DOCKER ]
then
$JAVA $JAVA_OPT -classpath ${DEMO_HOME}/conf:${DEMO_HOME}/apps/*:${DEMO_HOME}/lib/* $DEMO_MAIN >> ${DEMO_LOG_HOME}/demo_http_pub.out
diff --git a/eventmesh-test/bin/http_sub.sh b/eventmesh-test/bin/http_sub.sh
index 67a61e8d86..f5413ca64d 100644
--- a/eventmesh-test/bin/http_sub.sh
+++ b/eventmesh-test/bin/http_sub.sh
@@ -1,18 +1,21 @@
#!/bin/sh
-
-
-# Copyright (C) @2017 Webank Group Holding Limited
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
-# in compliance with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
#
-# Unless required by applicable law or agreed to in writing, software distributed under the License
-# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-# or implied. See the License for the specific language governing permissions and limitations under
-# the License.
+# http://www.apache.org/licenses/LICENSE-2.0
#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
#===========================================================================================
# Java Environment Setting
@@ -43,13 +46,13 @@ function get_pid {
else
if [[ $OS =~ Msys ]]; then
# 在Msys上存在可能无法kill识别出的进程的BUG
- ppid=`jps -v | grep -i "com.webank.eventmesh.http.demo.sub.SpringBootDemoApplication" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ ppid=`jps -v | grep -i "org.apache.eventmesh.http.demo.sub.SpringBootDemoApplication" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
elif [[ $OS =~ Darwin ]]; then
# 已知问题:grep java 可能无法精确识别java进程
- ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "com.webank.eventmesh.http.demo.sub.SpringBootDemoApplication" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.http.demo.sub.SpringBootDemoApplication" | grep -Ev "^root" |awk -F ' ' {'print $2'})
else
#在Linux服务器上要求尽可能精确识别进程
- ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "com.webank.eventmesh.http.demo.sub.SpringBootDemoApplication" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "org.apache.eventmesh.http.demo.sub.SpringBootDemoApplication" | grep -Ev "^root" |awk -F ' ' {'print $2'})
fi
fi
echo "$ppid";
@@ -124,7 +127,7 @@ make_logs_dir
echo "using jdk[$JAVA]" >> ${DEMO_LOG_HOME}/demo_http_sub.out
-DEMO_MAIN=com.webank.eventmesh.http.demo.sub.SpringBootDemoApplication
+DEMO_MAIN=org.apache.eventmesh.http.demo.sub.SpringBootDemoApplication
if [ $DOCKER ]
then
$JAVA $JAVA_OPT -classpath ${DEMO_HOME}/conf:${DEMO_HOME}/apps/*:${DEMO_HOME}/lib/* $DEMO_MAIN >> ${DEMO_LOG_HOME}/demo_http_sub.out
diff --git a/eventmesh-test/bin/tcp_pub.sh b/eventmesh-test/bin/tcp_pub.sh
index 71b03dc1e5..fcf7c51214 100644
--- a/eventmesh-test/bin/tcp_pub.sh
+++ b/eventmesh-test/bin/tcp_pub.sh
@@ -1,18 +1,21 @@
#!/bin/sh
-
-
-# Copyright (C) @2017 Webank Group Holding Limited
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
-# in compliance with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
#
-# Unless required by applicable law or agreed to in writing, software distributed under the License
-# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-# or implied. See the License for the specific language governing permissions and limitations under
-# the License.
+# http://www.apache.org/licenses/LICENSE-2.0
#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
#===========================================================================================
# Java Environment Setting
@@ -43,13 +46,13 @@ function get_pid {
else
if [[ $OS =~ Msys ]]; then
# 在Msys上存在可能无法kill识别出的进程的BUG
- ppid=`jps -v | grep -i "com.webank.eventmesh.tcp.demo.AsyncPublish" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ ppid=`jps -v | grep -i "org.apache.eventmesh.tcp.demo.AsyncPublish" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
elif [[ $OS =~ Darwin ]]; then
# 已知问题:grep java 可能无法精确识别java进程
- ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "com.webank.eventmesh.tcp.demo.AsyncPublish" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.tcp.demo.AsyncPublish" | grep -Ev "^root" |awk -F ' ' {'print $2'})
else
#在Linux服务器上要求尽可能精确识别进程
- ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "com.webank.eventmesh.tcp.demo.AsyncPublish" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "org.apache.eventmesh.tcp.demo.AsyncPublish" | grep -Ev "^root" |awk -F ' ' {'print $2'})
fi
fi
echo "ppid";
@@ -124,7 +127,7 @@ make_logs_dir
echo "using jdk[$JAVA]" >> ${DEMO_LOG_HOME}/demo_tcp_pub.out
-DEMO_MAIN=com.webank.eventmesh.tcp.demo.AsyncPublish
+DEMO_MAIN=org.apache.eventmesh.tcp.demo.AsyncPublish
if [ $DOCKER ]
then
$JAVA $JAVA_OPT -classpath ${DEMO_HOME}/conf:${DEMO_HOME}/apps/*:${DEMO_HOME}/lib/* $DEMO_MAIN >> ${DEMO_LOG_HOME}/demo_tcp_pub.out
diff --git a/eventmesh-test/bin/tcp_pub_broadcast.sh b/eventmesh-test/bin/tcp_pub_broadcast.sh
index 3bcb18d1b4..25f2bc5619 100644
--- a/eventmesh-test/bin/tcp_pub_broadcast.sh
+++ b/eventmesh-test/bin/tcp_pub_broadcast.sh
@@ -1,18 +1,21 @@
#!/bin/sh
-
-
-# Copyright (C) @2017 Webank Group Holding Limited
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
-# in compliance with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
#
-# Unless required by applicable law or agreed to in writing, software distributed under the License
-# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-# or implied. See the License for the specific language governing permissions and limitations under
-# the License.
+# http://www.apache.org/licenses/LICENSE-2.0
#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
#===========================================================================================
# Java Environment Setting
@@ -43,13 +46,13 @@ function get_pid {
else
if [[ $OS =~ Msys ]]; then
# 在Msys上存在可能无法kill识别出的进程的BUG
- ppid=`jps -v | grep -i "com.webank.eventmesh.tcp.demo.AsyncPublishBroadcast" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ ppid=`jps -v | grep -i "org.apache.eventmesh.tcp.demo.AsyncPublishBroadcast" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
elif [[ $OS =~ Darwin ]]; then
# 已知问题:grep java 可能无法精确识别java进程
- ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "com.webank.eventmesh.tcp.demo.AsyncPublishBroadcast" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.tcp.demo.AsyncPublishBroadcast" | grep -Ev "^root" |awk -F ' ' {'print $2'})
else
#在Linux服务器上要求尽可能精确识别进程
- ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $DEMO_HOME | grep -i "com.webank.eventmesh.tcp.demo.AsyncPublishBroadcast" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $DEMO_HOME | grep -i "org.apache.eventmesh.tcp.demo.AsyncPublishBroadcast" | grep -Ev "^root" |awk -F ' ' {'print $2'})
fi
fi
echo "$ppid";
@@ -124,7 +127,7 @@ make_logs_dir
echo "using jdk[$JAVA]" >> ${DEMO_LOG_HOME}/demo_tcp_pub_broadcast.out
-DEMO_MAIN=com.webank.eventmesh.tcp.demo.AsyncPublishBroadcast
+DEMO_MAIN=org.apache.eventmesh.tcp.demo.AsyncPublishBroadcast
if [ $DOCKER ]
then
$JAVA $JAVA_OPT -classpath ${DEMO_HOME}/conf:${DEMO_HOME}/apps/*:${DEMO_HOME}/lib/* $DEMO_MAIN >> ${DEMO_LOG_HOME}/demo_tcp_pub_broadcast.out
diff --git a/eventmesh-test/bin/tcp_sub.sh b/eventmesh-test/bin/tcp_sub.sh
index 77f3aeb090..5a1a572cac 100644
--- a/eventmesh-test/bin/tcp_sub.sh
+++ b/eventmesh-test/bin/tcp_sub.sh
@@ -1,18 +1,21 @@
#!/bin/sh
-
-
-# Copyright (C) @2017 Webank Group Holding Limited
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
-# in compliance with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
#
-# Unless required by applicable law or agreed to in writing, software distributed under the License
-# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-# or implied. See the License for the specific language governing permissions and limitations under
-# the License.
+# http://www.apache.org/licenses/LICENSE-2.0
#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
#===========================================================================================
# Java Environment Setting
@@ -43,13 +46,13 @@ function get_pid {
else
if [[ $OS =~ Msys ]]; then
# 在Msys上存在可能无法kill识别出的进程的BUG
- ppid=`jps -v | grep -i "com.webank.eventmesh.tcp.demo.AsyncSubscribe" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ ppid=`jps -v | grep -i "org.apache.eventmesh.tcp.demo.AsyncSubscribe" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
elif [[ $OS =~ Darwin ]]; then
# 已知问题:grep java 可能无法精确识别java进程
- ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "com.webank.eventmesh.tcp.demo.AsyncSubscribe" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.tcp.demo.AsyncSubscribe" | grep -Ev "^root" |awk -F ' ' {'print $2'})
else
#在Linux服务器上要求尽可能精确识别进程
- ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $DEMO_HOME | grep -i "com.webank.eventmesh.tcp.demo.AsyncSubscribe" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $DEMO_HOME | grep -i "org.apache.eventmesh.tcp.demo.AsyncSubscribe" | grep -Ev "^root" |awk -F ' ' {'print $2'})
fi
fi
echo "$ppid";
@@ -124,7 +127,7 @@ make_logs_dir
echo "using jdk[$JAVA]" >> ${DEMO_LOG_HOME}/demo_tcp_sub.out
-DEMO_MAIN=com.webank.eventmesh.tcp.demo.AsyncSubscribe
+DEMO_MAIN=org.apache.eventmesh.tcp.demo.AsyncSubscribe
if [ $DOCKER ]
then
$JAVA $JAVA_OPT -classpath ${DEMO_HOME}/conf:${DEMO_HOME}/apps/*:${DEMO_HOME}/lib/* $DEMO_MAIN >> ${DEMO_LOG_HOME}/demo_tcp_sub.out
diff --git a/eventmesh-test/bin/tcp_sub_broadcast.sh b/eventmesh-test/bin/tcp_sub_broadcast.sh
index 41fbde6a4f..472f711b7d 100644
--- a/eventmesh-test/bin/tcp_sub_broadcast.sh
+++ b/eventmesh-test/bin/tcp_sub_broadcast.sh
@@ -1,18 +1,21 @@
#!/bin/sh
-
-
-# Copyright (C) @2017 Webank Group Holding Limited
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
-# in compliance with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
#
-# Unless required by applicable law or agreed to in writing, software distributed under the License
-# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-# or implied. See the License for the specific language governing permissions and limitations under
-# the License.
+# http://www.apache.org/licenses/LICENSE-2.0
#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
#===========================================================================================
# Java Environment Setting
@@ -43,13 +46,13 @@ function get_pid {
else
if [[ $OS =~ Msys ]]; then
# 在Msys上存在可能无法kill识别出的进程的BUG
- ppid=`jps -v | grep -i "com.webank.eventmesh.tcp.demo.AsyncSubscribeBroadcast" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ ppid=`jps -v | grep -i "org.apache.eventmesh.tcp.demo.AsyncSubscribeBroadcast" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
elif [[ $OS =~ Darwin ]]; then
# 已知问题:grep java 可能无法精确识别java进程
- ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "com.webank.eventmesh.tcp.demo.AsyncSubscribeBroadcast" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.tcp.demo.AsyncSubscribeBroadcast" | grep -Ev "^root" |awk -F ' ' {'print $2'})
else
#在Linux服务器上要求尽可能精确识别进程
- ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "com.webank.eventmesh.tcp.demo.AsyncSubscribeBroadcast" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "org.apache.eventmesh.tcp.demo.AsyncSubscribeBroadcast" | grep -Ev "^root" |awk -F ' ' {'print $2'})
fi
fi
echo "$ppid";
@@ -124,7 +127,7 @@ make_logs_dir
echo "using jdk[$JAVA]" >> ${DEMO_LOG_HOME}/demo_tcp_sub_broadcast.out
-DEMO_MAIN=com.webank.eventmesh.tcp.demo.AsyncSubscribeBroadcast
+DEMO_MAIN=org.apache.eventmesh.tcp.demo.AsyncSubscribeBroadcast
if [ $DOCKER ]
then
$JAVA $JAVA_OPT -classpath ${DEMO_HOME}/conf:${DEMO_HOME}/apps/*:${DEMO_HOME}/lib/* $DEMO_MAIN >> ${DEMO_LOG_HOME}/demo_tcp_sub_broadcast.out
diff --git a/eventmesh-test/build.gradle b/eventmesh-test/build.gradle
index 5e90bad522..d433a5bbad 100644
--- a/eventmesh-test/build.gradle
+++ b/eventmesh-test/build.gradle
@@ -1,81 +1,50 @@
-buildscript {
- repositories {
- // 优先使用国内源
- maven { url 'https://maven.aliyun.com/repository/public' }
- mavenCentral()
- }
-// dependencies {
-// // 让spring-boot支持gradle
-// classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
-// }
-}
-
-//apply plugin: 'org.springframework.boot'
-//apply plugin: "io.spring.dependency-management"
-apply plugin: 'java'
-apply plugin: "maven"
-apply plugin: "eclipse"
-apply plugin: "idea"
-
-group 'com.webank.eventmesh'
-version '1.2.0-SNAPSHOT'
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//group 'org.apache.eventmesh'
+//version '1.2.0-SNAPSHOT'
-sourceCompatibility = 1.8
-
-repositories {
- mavenCentral()
-}
-
-List apache_common = [
- "org.apache.commons:commons-text:1.9"
-]
List spring_framework = [
"org.springframework.boot:spring-boot-starter-web:2.1.6.RELEASE"
]
-List junit = [
- "junit:junit:4.12"
-]
-
-//List log4j2 = [
-// "org.apache.logging.log4j:log4j-api:2.13.3",
-// "org.apache.logging.log4j:log4j-core:2.13.3",
-// "org.apache.logging.log4j:log4j-slf4j-impl:2.13.3",
-// "org.apache.logging.log4j:log4j-web:2.13.3",
-// "com.lmax:disruptor:3.4.2"
-//]
-//
-//List sl4j = [
-// "org.slf4j:slf4j-api:1.7.30"
-//]
-
dependencies {
// compile log4j2, sl4j
// testCompile log4j2, sl4j
- compile project(":eventmesh-sdk-java"),spring_framework,apache_common
+ implementation project(":eventmesh-sdk-java"),project(":eventmesh-connector-api"),project(":eventmesh-common"),spring_framework
//Spring模块
- testCompile junit,apache_common
+ testImplementation project(":eventmesh-sdk-java"),project(":eventmesh-connector-api"),project(":eventmesh-common"),spring_framework
}
-configurations.all{
+configurations.all {
exclude group: "ch.qos.logback"
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
-clean.doFirst {
- delete 'build'
- delete 'dist'
-}
-
task testdist(dependsOn: ['jar']) {
- doFirst {
- new File(projectDir.getPath() , 'dist/bin').mkdirs()
- new File(projectDir.getPath() , 'dist/apps').mkdirs()
- new File(projectDir.getPath() , 'dist/conf').mkdirs()
- new File(projectDir.getPath() , 'dist/lib').mkdirs()
+ doFirst {BasicTest
+ new File(projectDir.getPath(), 'dist/bin').mkdirs()
+ new File(projectDir.getPath(), 'dist/apps').mkdirs()
+ new File(projectDir.getPath(), 'dist/conf').mkdirs()
+ new File(projectDir.getPath(), 'dist/lib').mkdirs()
}
doLast {
diff --git a/eventmesh-test/conf/application.properties b/eventmesh-test/conf/application.properties
index 2886a8c218..8289cb6b01 100644
--- a/eventmesh-test/conf/application.properties
+++ b/eventmesh-test/conf/application.properties
@@ -1,3 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
server.port=8088
eventmesh.ip=127.0.0.1
eventmesh.http.port=10105
diff --git a/eventmesh-test/conf/log4j2.xml b/eventmesh-test/conf/log4j2.xml
index 1483ca35fd..87bd36cde3 100644
--- a/eventmesh-test/conf/log4j2.xml
+++ b/eventmesh-test/conf/log4j2.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/eventmesh-test/conf/server.env b/eventmesh-test/conf/server.env
index 77e68cefeb..3bef8c5fcf 100644
--- a/eventmesh-test/conf/server.env
+++ b/eventmesh-test/conf/server.env
@@ -1 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
APP_START_JVM_OPTION:::-server -Xms64M -Xmx128M -Xmn64m -XX:SurvivorRatio=4 -Duser.language=zh
diff --git a/eventmesh-test/gradle.properties b/eventmesh-test/gradle.properties
index e7cdcc01d2..60d084498a 100644
--- a/eventmesh-test/gradle.properties
+++ b/eventmesh-test/gradle.properties
@@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
-group=com.webank.eventmesh
+group=org.apache.eventmesh
version=1.2.0-SNAPSHOT
mavenUserName=
mavenPassword=
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/SpringBootDemoApplication.java b/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/SpringBootDemoApplication.java
deleted file mode 100644
index e8edbfb38e..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/SpringBootDemoApplication.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.webank.eventmesh.http.demo.sub;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-
-@SpringBootApplication
-@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
-public class SpringBootDemoApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(SpringBootDemoApplication.class, args);
- }
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/controller/SubController.java b/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/controller/SubController.java
deleted file mode 100644
index b268b8b5c7..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/controller/SubController.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.webank.eventmesh.http.demo.sub.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-
-@RestController
-@RequestMapping("/sub")
-public class SubController {
-
- public static Logger logger = LoggerFactory.getLogger(SubController.class);
-
- @RequestMapping(value = "/test", method = RequestMethod.POST)
- public String subTest(@RequestBody String message){
- logger.info("=======receive message======= {}", JSONObject.toJSONString(message));
- JSONObject result = new JSONObject();
- result.put("retCode", 1);
- return result.toJSONString();
- }
-
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/common/EventMeshTestCaseTopicSet.java b/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/common/EventMeshTestCaseTopicSet.java
deleted file mode 100644
index 4f2fa832a2..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/common/EventMeshTestCaseTopicSet.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.webank.eventmesh.tcp.common;
-
-/**
- * Testcase set
- */
-public class EventMeshTestCaseTopicSet {
-
-// public static final String TOPIC_PRX_WQ2ClientBroadCast = "topic-broadcast-test";
- public static final String TOPIC_PRX_WQ2ClientBroadCast = "FT0-e-80030000-01-3";
-
-// public static final String TOPIC_PRX_SyncSubscribeTest = "topic-sync-test";
- public static final String TOPIC_PRX_SyncSubscribeTest = "FT0-s-80000000-01-0";
-
-// public static final String TOPIC_PRX_WQ2ClientUniCast = "topic-async-test";
- public static final String TOPIC_PRX_WQ2ClientUniCast = "FT0-e-80010000-01-1";
-
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncPublish.java b/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncPublish.java
deleted file mode 100644
index 74ac50d167..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncPublish.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.webank.eventmesh.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.util.Utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-public class AsyncPublish{
-
- public static Logger logger = LoggerFactory.getLogger(AsyncPublish.class);
-
- private static EventMeshClient client;
-
- public static AsyncPublish handler = new AsyncPublish();
-
-
- public static void main(String[] agrs)throws Exception{
- Properties properties = Utils.readPropertiesFile("application.properties");
- final String eventMeshIp = properties.getProperty("eventmesh.ip");
- final int eventMeshTcpPort = Integer.parseInt(properties.getProperty("eventmesh.tcp.port"));
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient1();
- client = new DefaultEventMeshClient(eventMeshIp,eventMeshTcpPort,userAgent);
- client.init();
- client.heartbeat();
-
- for(int i=0; i < 5; i++) {
- Package asyncMsg = EventMeshTestUtils.asyncMessage();
- logger.info("begin send async msg[{}]==================={}", i, asyncMsg);
- client.publish(asyncMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
-
- Thread.sleep(1000);
- }
-
- Thread.sleep(2000);
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("AsyncPublish failed", e);
- }
- }
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncPublishBroadcast.java b/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncPublishBroadcast.java
deleted file mode 100644
index ad142424ae..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncPublishBroadcast.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.webank.eventmesh.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.util.Utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-public class AsyncPublishBroadcast {
-
- public static Logger logger = LoggerFactory.getLogger(AsyncPublishBroadcast.class);
-
- private static EventMeshClient client;
-
- public static void main(String[] agrs)throws Exception{
- Properties properties = Utils.readPropertiesFile("application.properties");
- final String eventMeshIp = properties.getProperty("eventmesh.ip");
- final int eventMeshTcpPort = Integer.parseInt(properties.getProperty("eventmesh.tcp.port"));
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient1();
- client = new DefaultEventMeshClient(eventMeshIp,eventMeshTcpPort,userAgent);
- client.init();
- client.heartbeat();
-
- Package broadcastMsg = EventMeshTestUtils.broadcastMessage();
- logger.info("begin send broadcast msg============={}", broadcastMsg);
- client.broadcast(broadcastMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
-
- Thread.sleep(2000);
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("AsyncPublishBroadcast failed", e);
- }
- }
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncSubscribe.java b/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncSubscribe.java
deleted file mode 100644
index d84cfd3389..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncSubscribe.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.webank.eventmesh.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.util.Utils;
-import io.netty.channel.ChannelHandlerContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-public class AsyncSubscribe implements ReceiveMsgHook {
-
- public static Logger logger = LoggerFactory.getLogger(AsyncSubscribe.class);
-
- private static EventMeshClient client;
-
- public static AsyncSubscribe handler = new AsyncSubscribe();
-
- public static void main(String[] agrs)throws Exception{
- Properties properties = Utils.readPropertiesFile("application.properties");
- final String eventMeshIp = properties.getProperty("eventmesh.ip");
- final int eventMeshTcpPort = Integer.parseInt(properties.getProperty("eventmesh.tcp.port"));
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient2();
- client = new DefaultEventMeshClient(eventMeshIp,eventMeshTcpPort,userAgent);
- client.init();
- client.heartbeat();
-
- client.subscribe("FT0-e-80010000-01-1");
- client.registerSubBusiHandler(handler);
-
- client.listen();
-
- //client.unsubscribe();
-
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("AsyncSubscribe failed", e);
- }
- }
-
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- EventMeshMessage eventMeshMessage = (EventMeshMessage)msg.getBody();
- logger.info("receive async msg====================={}", eventMeshMessage);
- }
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncSubscribeBroadcast.java b/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncSubscribeBroadcast.java
deleted file mode 100644
index 731842cb33..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/AsyncSubscribeBroadcast.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.webank.eventmesh.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.tcp.common.EventMeshTestUtils;
-import com.webank.eventmesh.util.Utils;
-import io.netty.channel.ChannelHandlerContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-public class AsyncSubscribeBroadcast implements ReceiveMsgHook {
-
- public static Logger logger = LoggerFactory.getLogger(AsyncSubscribeBroadcast.class);
-
- private static EventMeshClient client;
-
- public static AsyncSubscribeBroadcast handler = new AsyncSubscribeBroadcast();
-
- public static void main(String[] agrs)throws Exception{
- Properties properties = Utils.readPropertiesFile("application.properties");
- final String eventMeshIp = properties.getProperty("eventmesh.ip");
- final int eventMeshTcpPort = Integer.parseInt(properties.getProperty("eventmesh.tcp.port"));
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient2();
- client = new DefaultEventMeshClient(eventMeshIp,eventMeshTcpPort,userAgent);
- client.init();
- client.heartbeat();
-
- client.subscribe("FT0-e-80030000-01-3");
- client.registerSubBusiHandler(handler);
-
- client.listen();
-
- //client.unsubscribe();
-
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("AsyncSubscribeBroadcast failed", e);
- }
- }
-
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- EventMeshMessage eventMeshMessage = (EventMeshMessage)msg.getBody();
- logger.info("receive broadcast msg==============={}", eventMeshMessage);
- }
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/SyncRequest.java b/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/SyncRequest.java
deleted file mode 100644
index b4bb47cebd..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/SyncRequest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.webank.eventmesh.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.EventMeshCommon;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.tcp.common.EventMeshTestUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SyncRequest {
-
- public static Logger logger = LoggerFactory.getLogger(SyncRequest.class);
-
- private static EventMeshClient client;
-
- public static void main(String[] agrs)throws Exception{
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient1();
- client = new DefaultEventMeshClient("127.0.0.1",10000,userAgent);
- client.init();
- client.heartbeat();
-
- Package rrMsg = EventMeshTestUtils.syncRR();
- logger.info("begin send rr msg=================={}",rrMsg);
- Package response = client.rr(rrMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
- logger.info("receive rr reply==================={}",response);
-
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("SyncRequest failed", e);
- }
- }
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/SyncResponse.java b/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/SyncResponse.java
deleted file mode 100644
index acd8776a36..0000000000
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/tcp/demo/SyncResponse.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.webank.eventmesh.tcp.demo;
-
-import com.webank.eventmesh.client.tcp.EventMeshClient;
-import com.webank.eventmesh.client.tcp.common.ReceiveMsgHook;
-import com.webank.eventmesh.client.tcp.impl.DefaultEventMeshClient;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
-import com.webank.eventmesh.tcp.common.EventMeshTestUtils;
-import io.netty.channel.ChannelHandlerContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SyncResponse implements ReceiveMsgHook {
-
- public static Logger logger = LoggerFactory.getLogger(SyncResponse.class);
-
- private static EventMeshClient client;
-
- public static SyncResponse handler = new SyncResponse();
-
- public static void main(String[] agrs)throws Exception{
- try{
- UserAgent userAgent = EventMeshTestUtils.generateClient2();
- client = new DefaultEventMeshClient("127.0.0.1",10000,userAgent);
- client.init();
- client.heartbeat();
-
- client.subscribe("FT0-s-80000000-01-0");
- //同步RR消息
- client.registerSubBusiHandler(handler);
-
- client.listen();
-
- //client.unsubscribe();
-
- //退出,销毁资源
-// client.close();
- }catch (Exception e){
- logger.warn("SyncResponse failed", e);
- }
- }
-
- @Override
- public void handle(Package msg, ChannelHandlerContext ctx) {
- logger.info("receive sync rr msg================{}", msg);
- Package pkg = EventMeshTestUtils.rrResponse(msg);
- ctx.writeAndFlush(pkg);
- }
-}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/AsyncPublishInstance.java b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/AsyncPublishInstance.java
similarity index 64%
rename from eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/AsyncPublishInstance.java
rename to eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/AsyncPublishInstance.java
index 14b3ee35f4..b718bcc2e0 100644
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/AsyncPublishInstance.java
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/AsyncPublishInstance.java
@@ -1,18 +1,36 @@
-package com.webank.eventmesh.http.demo;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.producer.LiteProducer;
-import com.webank.eventmesh.common.Constants;
-import com.webank.eventmesh.common.IPUtil;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.ThreadUtil;
-import com.webank.eventmesh.util.Utils;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.http.demo;
+
+import java.util.Properties;
+
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.producer.LiteProducer;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.IPUtil;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.ThreadUtil;
+import org.apache.eventmesh.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Properties;
-
public class AsyncPublishInstance {
public static Logger logger = LoggerFactory.getLogger(AsyncPublishInstance.class);
@@ -23,7 +41,7 @@ public static void main(String[] args) throws Exception {
final String eventMeshHttpPort = properties.getProperty("eventmesh.http.port");
LiteProducer liteProducer = null;
- try{
+ try {
// String eventMeshIPPort = args[0];
String eventMeshIPPort = eventMeshIp + ":" + eventMeshHttpPort;
// final String topic = args[1];
@@ -44,7 +62,7 @@ public static void main(String[] args) throws Exception {
liteProducer = new LiteProducer(eventMeshClientConfig);
liteProducer.start();
- for(int i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
LiteMessage liteMessage = new LiteMessage();
liteMessage.setBizSeqNo(RandomStringUtils.randomNumeric(30))
// .setContent("contentStr with special protocal")
@@ -57,16 +75,16 @@ public static void main(String[] args) throws Exception {
Thread.sleep(1000);
logger.info("publish result , {}", flag);
}
- }catch (Exception e){
+ } catch (Exception e) {
logger.warn("publish msg failed", e);
}
- try{
+ try {
Thread.sleep(30000);
- if(liteProducer != null){
+ if (liteProducer != null) {
liteProducer.shutdown();
}
- }catch (Exception e1){
+ } catch (Exception e1) {
logger.warn("producer shutdown exception", e1);
}
}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/AsyncSyncRequestInstance.java b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/AsyncSyncRequestInstance.java
similarity index 67%
rename from eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/AsyncSyncRequestInstance.java
rename to eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/AsyncSyncRequestInstance.java
index b442061dee..54b2f2cbca 100644
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/AsyncSyncRequestInstance.java
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/AsyncSyncRequestInstance.java
@@ -1,18 +1,36 @@
-package com.webank.eventmesh.http.demo;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.producer.LiteProducer;
-import com.webank.eventmesh.client.http.producer.RRCallback;
-import com.webank.eventmesh.common.IPUtil;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.ThreadUtil;
-import com.webank.eventmesh.util.Utils;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.http.demo;
+
+import java.util.Properties;
+
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.producer.LiteProducer;
+import org.apache.eventmesh.client.http.producer.RRCallback;
+import org.apache.eventmesh.common.IPUtil;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.ThreadUtil;
+import org.apache.eventmesh.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Properties;
-
public class AsyncSyncRequestInstance {
public static Logger logger = LoggerFactory.getLogger(AsyncSyncRequestInstance.class);
@@ -69,12 +87,12 @@ public void onException(Throwable e) {
logger.warn("async send msg failed", e);
}
- try{
+ try {
Thread.sleep(30000);
- if(liteProducer != null){
+ if (liteProducer != null) {
liteProducer.shutdown();
}
- }catch (Exception e1){
+ } catch (Exception e1) {
logger.warn("producer shutdown exception", e1);
}
}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/SyncRequestInstance.java b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/SyncRequestInstance.java
similarity index 63%
rename from eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/SyncRequestInstance.java
rename to eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/SyncRequestInstance.java
index 878027b408..239beeadde 100644
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/http/demo/SyncRequestInstance.java
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/SyncRequestInstance.java
@@ -1,11 +1,29 @@
-package com.webank.eventmesh.client.http.demo;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.producer.LiteProducer;
-import com.webank.eventmesh.common.IPUtil;
-import com.webank.eventmesh.common.LiteMessage;
-import com.webank.eventmesh.common.ThreadUtil;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.http.demo;
+
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.producer.LiteProducer;
+import org.apache.eventmesh.common.IPUtil;
+import org.apache.eventmesh.common.LiteMessage;
+import org.apache.eventmesh.common.ThreadUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,12 +71,12 @@ public static void main(String[] args) throws Exception {
logger.warn("send msg failed", e);
}
- try{
+ try {
Thread.sleep(30000);
- if(liteProducer != null){
+ if (liteProducer != null) {
liteProducer.shutdown();
}
- }catch (Exception e1){
+ } catch (Exception e1) {
logger.warn("producer shutdown exception", e1);
}
}
diff --git a/eventmesh-runtime/src/test/java/protocol/CmdHelloTest.java b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/SpringBootDemoApplication.java
similarity index 58%
rename from eventmesh-runtime/src/test/java/protocol/CmdHelloTest.java
rename to eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/SpringBootDemoApplication.java
index c472c384bc..931e608a27 100644
--- a/eventmesh-runtime/src/test/java/protocol/CmdHelloTest.java
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/SpringBootDemoApplication.java
@@ -15,22 +15,18 @@
* limitations under the License.
*/
-package protocol;
+package org.apache.eventmesh.http.demo.sub;
-import client.common.Server;
-import org.junit.Test;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-public class CmdHelloTest {
+@SpringBootApplication
+@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
+public class SpringBootDemoApplication {
- @Test
- public void test_Cmd_Hello() throws Exception {
- Server server = new Server();
- server.startAccessServer();
-
- //do protocol send/receive
-
- Thread.sleep(3000);
- server.shutdownAccessServer();
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootDemoApplication.class, args);
}
-
}
diff --git a/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/controller/SubController.java b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/controller/SubController.java
new file mode 100644
index 0000000000..8f8a7a7f9b
--- /dev/null
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/controller/SubController.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.http.demo.sub.controller;
+
+import com.alibaba.fastjson.JSONObject;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+
+@RestController
+@RequestMapping("/sub")
+public class SubController {
+
+ public static Logger logger = LoggerFactory.getLogger(SubController.class);
+
+ @RequestMapping(value = "/test", method = RequestMethod.POST)
+ public String subTest(@RequestBody String message) {
+ logger.info("=======receive message======= {}", JSONObject.toJSONString(message));
+ JSONObject result = new JSONObject();
+ result.put("retCode", 1);
+ return result.toJSONString();
+ }
+
+}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/service/SubService.java b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java
similarity index 88%
rename from eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/service/SubService.java
rename to eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java
index a21f31aeed..e20fea98be 100644
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/http/demo/sub/service/SubService.java
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java
@@ -1,21 +1,21 @@
-package com.webank.eventmesh.http.demo.sub.service;
+package org.apache.eventmesh.http.demo.sub.service;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
-import com.webank.eventmesh.client.http.conf.LiteClientConfig;
-import com.webank.eventmesh.client.http.consumer.LiteConsumer;
-import com.webank.eventmesh.common.IPUtil;
-import com.webank.eventmesh.common.EventMeshException;
-import com.webank.eventmesh.common.ThreadUtil;
-import com.webank.eventmesh.util.Utils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.eventmesh.client.http.conf.LiteClientConfig;
+import org.apache.eventmesh.client.http.consumer.LiteConsumer;
+import org.apache.eventmesh.common.EventMeshException;
+import org.apache.eventmesh.common.IPUtil;
+import org.apache.eventmesh.common.ThreadUtil;
+import org.apache.eventmesh.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
@Component
public class SubService implements InitializingBean {
diff --git a/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/common/EventMeshTestCaseTopicSet.java b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/common/EventMeshTestCaseTopicSet.java
new file mode 100644
index 0000000000..e229c85184
--- /dev/null
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/common/EventMeshTestCaseTopicSet.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.tcp.common;
+
+/**
+ * Testcase set
+ */
+public class EventMeshTestCaseTopicSet {
+
+ // public static final String TOPIC_PRX_WQ2ClientBroadCast = "topic-broadcast-test";
+ public static final String TOPIC_PRX_WQ2ClientBroadCast = "FT0-e-80030000-01-3";
+
+ // public static final String TOPIC_PRX_SyncSubscribeTest = "topic-sync-test";
+ public static final String TOPIC_PRX_SyncSubscribeTest = "FT0-s-80000000-01-0";
+
+ // public static final String TOPIC_PRX_WQ2ClientUniCast = "topic-async-test";
+ public static final String TOPIC_PRX_WQ2ClientUniCast = "FT0-e-80010000-01-1";
+
+}
diff --git a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/common/EventMeshTestUtils.java b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/common/EventMeshTestUtils.java
similarity index 75%
rename from eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/common/EventMeshTestUtils.java
rename to eventmesh-test/src/main/java/org/apache/eventmesh/tcp/common/EventMeshTestUtils.java
index a2ae673e10..dedce3a05b 100644
--- a/eventmesh-sdk-java/src/test/java/com/webank/eventmesh/client/tcp/common/EventMeshTestUtils.java
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/common/EventMeshTestUtils.java
@@ -1,15 +1,34 @@
-package com.webank.eventmesh.client.tcp.common;
-
-import com.webank.eventmesh.common.protocol.tcp.EventMeshMessage;
-import com.webank.eventmesh.common.protocol.tcp.Command;
-import com.webank.eventmesh.common.protocol.tcp.Header;
-import com.webank.eventmesh.common.protocol.tcp.Package;
-import com.webank.eventmesh.common.protocol.tcp.UserAgent;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.tcp.common;
+
+import static org.apache.eventmesh.common.protocol.tcp.Command.RESPONSE_TO_SERVER;
+import static org.apache.eventmesh.tcp.common.EventMeshTestCaseTopicSet.TOPIC_PRX_SyncSubscribeTest;
+import static org.apache.eventmesh.tcp.common.EventMeshTestCaseTopicSet.TOPIC_PRX_WQ2ClientBroadCast;
+import static org.apache.eventmesh.tcp.common.EventMeshTestCaseTopicSet.TOPIC_PRX_WQ2ClientUniCast;
import java.util.concurrent.ThreadLocalRandom;
-import static com.webank.eventmesh.client.tcp.common.EventMeshTestCaseTopicSet.*;
-import static com.webank.eventmesh.common.protocol.tcp.Command.RESPONSE_TO_SERVER;
+import org.apache.eventmesh.common.protocol.tcp.Command;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Header;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
public class EventMeshTestUtils {
private static final int seqLength = 10;
diff --git a/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncPublish.java b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncPublish.java
new file mode 100644
index 0000000000..73cc045c64
--- /dev/null
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncPublish.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.tcp.demo;
+
+import java.util.Properties;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.util.Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncPublish {
+
+ public static Logger logger = LoggerFactory.getLogger(AsyncPublish.class);
+
+ private static EventMeshClient client;
+
+ public static AsyncPublish handler = new AsyncPublish();
+
+
+ public static void main(String[] agrs) throws Exception {
+ Properties properties = Utils.readPropertiesFile("application.properties");
+ final String eventMeshIp = properties.getProperty("eventmesh.ip");
+ final int eventMeshTcpPort = Integer.parseInt(properties.getProperty("eventmesh.tcp.port"));
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient1();
+ client = new DefaultEventMeshClient(eventMeshIp, eventMeshTcpPort, userAgent);
+ client.init();
+ client.heartbeat();
+
+ for (int i = 0; i < 5; i++) {
+ Package asyncMsg = EventMeshTestUtils.asyncMessage();
+ logger.info("begin send async msg[{}]==================={}", i, asyncMsg);
+ client.publish(asyncMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
+
+ Thread.sleep(1000);
+ }
+
+ Thread.sleep(2000);
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("AsyncPublish failed", e);
+ }
+ }
+}
diff --git a/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncPublishBroadcast.java b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncPublishBroadcast.java
new file mode 100644
index 0000000000..923c04a90b
--- /dev/null
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncPublishBroadcast.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.tcp.demo;
+
+import java.util.Properties;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.util.Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncPublishBroadcast {
+
+ public static Logger logger = LoggerFactory.getLogger(AsyncPublishBroadcast.class);
+
+ private static EventMeshClient client;
+
+ public static void main(String[] agrs) throws Exception {
+ Properties properties = Utils.readPropertiesFile("application.properties");
+ final String eventMeshIp = properties.getProperty("eventmesh.ip");
+ final int eventMeshTcpPort = Integer.parseInt(properties.getProperty("eventmesh.tcp.port"));
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient1();
+ client = new DefaultEventMeshClient(eventMeshIp, eventMeshTcpPort, userAgent);
+ client.init();
+ client.heartbeat();
+
+ Package broadcastMsg = EventMeshTestUtils.broadcastMessage();
+ logger.info("begin send broadcast msg============={}", broadcastMsg);
+ client.broadcast(broadcastMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
+
+ Thread.sleep(2000);
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("AsyncPublishBroadcast failed", e);
+ }
+ }
+}
diff --git a/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncSubscribe.java b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncSubscribe.java
new file mode 100644
index 0000000000..1f7d3c89b3
--- /dev/null
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncSubscribe.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.tcp.demo;
+
+import java.util.Properties;
+
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.util.Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncSubscribe implements ReceiveMsgHook {
+
+ public static Logger logger = LoggerFactory.getLogger(AsyncSubscribe.class);
+
+ private static EventMeshClient client;
+
+ public static AsyncSubscribe handler = new AsyncSubscribe();
+
+ public static void main(String[] agrs) throws Exception {
+ Properties properties = Utils.readPropertiesFile("application.properties");
+ final String eventMeshIp = properties.getProperty("eventmesh.ip");
+ final int eventMeshTcpPort = Integer.parseInt(properties.getProperty("eventmesh.tcp.port"));
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient2();
+ client = new DefaultEventMeshClient(eventMeshIp, eventMeshTcpPort, userAgent);
+ client.init();
+ client.heartbeat();
+
+ client.subscribe("FT0-e-80010000-01-1");
+ client.registerSubBusiHandler(handler);
+
+ client.listen();
+
+ //client.unsubscribe();
+
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("AsyncSubscribe failed", e);
+ }
+ }
+
+ @Override
+ public void handle(Package msg, ChannelHandlerContext ctx) {
+ EventMeshMessage eventMeshMessage = (EventMeshMessage) msg.getBody();
+ logger.info("receive async msg====================={}", eventMeshMessage);
+ }
+}
diff --git a/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncSubscribeBroadcast.java b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncSubscribeBroadcast.java
new file mode 100644
index 0000000000..74bdaaa212
--- /dev/null
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/AsyncSubscribeBroadcast.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.tcp.demo;
+
+import java.util.Properties;
+
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.util.Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncSubscribeBroadcast implements ReceiveMsgHook {
+
+ public static Logger logger = LoggerFactory.getLogger(AsyncSubscribeBroadcast.class);
+
+ private static EventMeshClient client;
+
+ public static AsyncSubscribeBroadcast handler = new AsyncSubscribeBroadcast();
+
+ public static void main(String[] agrs) throws Exception {
+ Properties properties = Utils.readPropertiesFile("application.properties");
+ final String eventMeshIp = properties.getProperty("eventmesh.ip");
+ final int eventMeshTcpPort = Integer.parseInt(properties.getProperty("eventmesh.tcp.port"));
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient2();
+ client = new DefaultEventMeshClient(eventMeshIp, eventMeshTcpPort, userAgent);
+ client.init();
+ client.heartbeat();
+
+ client.subscribe("FT0-e-80030000-01-3");
+ client.registerSubBusiHandler(handler);
+
+ client.listen();
+
+ //client.unsubscribe();
+
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("AsyncSubscribeBroadcast failed", e);
+ }
+ }
+
+ @Override
+ public void handle(Package msg, ChannelHandlerContext ctx) {
+ EventMeshMessage eventMeshMessage = (EventMeshMessage) msg.getBody();
+ logger.info("receive broadcast msg==============={}", eventMeshMessage);
+ }
+}
diff --git a/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/SyncRequest.java b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/SyncRequest.java
new file mode 100644
index 0000000000..d25f29dfbb
--- /dev/null
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/SyncRequest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.tcp.demo;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.tcp.common.EventMeshTestUtils;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SyncRequest {
+
+ public static Logger logger = LoggerFactory.getLogger(SyncRequest.class);
+
+ private static EventMeshClient client;
+
+ public static void main(String[] agrs) throws Exception {
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient1();
+ client = new DefaultEventMeshClient("127.0.0.1", 10000, userAgent);
+ client.init();
+ client.heartbeat();
+
+ Package rrMsg = EventMeshTestUtils.syncRR();
+ logger.info("begin send rr msg=================={}", rrMsg);
+ Package response = client.rr(rrMsg, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
+ logger.info("receive rr reply==================={}", response);
+
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("SyncRequest failed", e);
+ }
+ }
+}
diff --git a/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/SyncResponse.java b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/SyncResponse.java
new file mode 100644
index 0000000000..969163d44b
--- /dev/null
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/tcp/demo/SyncResponse.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.tcp.demo;
+
+import io.netty.channel.ChannelHandlerContext;
+
+import org.apache.eventmesh.client.tcp.EventMeshClient;
+import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook;
+import org.apache.eventmesh.client.tcp.impl.DefaultEventMeshClient;
+import org.apache.eventmesh.common.protocol.tcp.Package;
+import org.apache.eventmesh.common.protocol.tcp.UserAgent;
+import org.apache.eventmesh.tcp.common.EventMeshTestUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SyncResponse implements ReceiveMsgHook {
+
+ public static Logger logger = LoggerFactory.getLogger(SyncResponse.class);
+
+ private static EventMeshClient client;
+
+ public static SyncResponse handler = new SyncResponse();
+
+ public static void main(String[] agrs) throws Exception {
+ try {
+ UserAgent userAgent = EventMeshTestUtils.generateClient2();
+ client = new DefaultEventMeshClient("127.0.0.1", 10000, userAgent);
+ client.init();
+ client.heartbeat();
+
+ client.subscribe("FT0-s-80000000-01-0");
+ //同步RR消息
+ client.registerSubBusiHandler(handler);
+
+ client.listen();
+
+ //client.unsubscribe();
+
+ //退出,销毁资源
+// client.close();
+ } catch (Exception e) {
+ logger.warn("SyncResponse failed", e);
+ }
+ }
+
+ @Override
+ public void handle(Package msg, ChannelHandlerContext ctx) {
+ logger.info("receive sync rr msg================{}", msg);
+ Package pkg = EventMeshTestUtils.rrResponse(msg);
+ ctx.writeAndFlush(pkg);
+ }
+}
diff --git a/eventmesh-test/src/main/java/com/webank/eventmesh/util/Utils.java b/eventmesh-test/src/main/java/org/apache/eventmesh/util/Utils.java
similarity index 74%
rename from eventmesh-test/src/main/java/com/webank/eventmesh/util/Utils.java
rename to eventmesh-test/src/main/java/org/apache/eventmesh/util/Utils.java
index 1e4450ede1..c20b91b6e5 100644
--- a/eventmesh-test/src/main/java/com/webank/eventmesh/util/Utils.java
+++ b/eventmesh-test/src/main/java/org/apache/eventmesh/util/Utils.java
@@ -1,8 +1,21 @@
-package com.webank.eventmesh.util;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PropertiesLoaderUtils;
+package org.apache.eventmesh.util;
import java.net.InetAddress;
import java.net.NetworkInterface;
@@ -11,6 +24,10 @@
import java.util.Enumeration;
import java.util.Properties;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PropertiesLoaderUtils;
+
public class Utils {
/**
@@ -50,11 +67,11 @@ public static boolean isWindowsOS() {
private static String getLinuxLocalIp() throws SocketException {
String ip = "";
try {
- for (Enumeration en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
+ for (Enumeration en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
NetworkInterface intf = en.nextElement();
String name = intf.getName();
if (!name.contains("docker") && !name.contains("lo")) {
- for (Enumeration enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
+ for (Enumeration enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()) {
String ipaddress = inetAddress.getHostAddress().toString();
diff --git a/gradle.properties b/gradle.properties
index 795561d41e..34542ec282 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -14,11 +14,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-group=com.webank.eventmesh
-version=1.2.0-SNAPSHOT
-rocketmqVersion=4.4.0
jdk=1.8
snapshot=false
-mavenUserName=
-mavenPassword=
-#org.gradle.java.home=C:\\Program Files\\Java\\jdk1.7.0_67
+group=org.apache.eventmesh
+version=1.2.0-SNAPSHOT
+#last eight bits of public key
+signing.keyId=
+#passphrase for key pairs
+signing.password=
+#path of exporting private key
+signing.secretKeyRingFile=
+#apache id
+apacheUserName=
+#apache password
+apachePassWord=
+signEnabled=false
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 442d9132ea..1ad74a57e2 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/package.json b/package.json
deleted file mode 100644
index 77057b3165..0000000000
--- a/package.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "zqq",
- "version": "1.0.0",
- "description": "[](https://www.travis-ci.org/WeBankFinTech/EventMesh) [](https://coveralls.io/github/WeBankFinTech/EventMesh?branch=master) [](https://github.com/WeBankFinTech/EventMesh/releases) [](https://www.apache.org/licenses/LICENSE-2.0.html)",
- "main": "index.js",
- "directories": {
- "doc": "docs"
- },
- "scripts": {
- "docs:dev": "vuepress dev docs",
- "docs:build": "vuepress build docs"
- },
- "keywords": [],
- "author": "",
- "license": "ISC",
- "devDependencies": {
- "vuepress": "^1.7.1"
- }
-}
diff --git a/settings.gradle b/settings.gradle
index b7f436b771..ea31ffdc16 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -17,11 +17,5 @@
rootProject.name = 'EventMesh'
String jdkVersion = "${jdk}"
-include 'eventmesh-runtime'
-include 'eventmesh-connector-rocketmq'
-include 'eventmesh-sdk-java'
-include 'eventmesh-common'
-include 'eventmesh-connector-api'
-include 'eventmesh-starter'
-include 'eventmesh-test'
+include 'eventmesh-runtime','eventmesh-connector-rocketmq','eventmesh-sdk-java','eventmesh-common','eventmesh-connector-api','eventmesh-starter','eventmesh-test'
diff --git a/style/codeStyle.xml b/style/codeStyle.xml
index 9b4e561f9c..6b60186f16 100644
--- a/style/codeStyle.xml
+++ b/style/codeStyle.xml
@@ -15,7 +15,7 @@
~ limitations under the License.
-->
-
+