This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 648f3e983 [ISSUE #4750] Replace sun.net.httpserver.HttpServer to use
netty server (#4739)
648f3e983 is described below
commit 648f3e9838709635d4d5cd7851d58e37e30b2498
Author: Karson <[email protected]>
AuthorDate: Sun Feb 4 18:25:03 2024 +0800
[ISSUE #4750] Replace sun.net.httpserver.HttpServer to use netty server
(#4739)
* fix 4738
* fix some bug
* fix bug
* remove initProducerManager from AbstractRemotingServer init
* bug fix
* bug fix
* some enhance
* some enhance
* add admin bootstrap
* some enhance
* remove HttpHandlerManager and ClientManageController.
* modify some unit test
* add admin http handlermanager
---
.../admin/controller/ClientManageController.java | 162 -----------
.../admin/controller/HttpHandlerManager.java | 65 -----
.../runtime/admin/handler/AbstractHttpHandler.java | 8 -
.../runtime/admin/handler/AdminHandlerManager.java | 98 +++++++
.../admin/handler/ConfigurationHandler.java | 23 +-
.../admin/handler/DeleteWebHookConfigHandler.java | 7 +-
.../runtime/admin/handler/EventHandler.java | 8 +-
.../runtime/admin/handler/GrpcClientHandler.java | 26 +-
.../runtime/admin/handler/HTTPClientHandler.java | 26 +-
.../admin/handler/InsertWebHookConfigHandler.java | 7 +-
.../runtime/admin/handler/MetaHandler.java | 26 +-
.../runtime/admin/handler/MetricsHandler.java | 8 +-
.../handler/QueryRecommendEventMeshHandler.java | 14 +-
.../handler/QueryWebHookConfigByIdHandler.java | 12 +-
.../QueryWebHookConfigByManufacturerHandler.java | 32 +--
.../handler/RedirectClientByIpPortHandler.java | 22 +-
.../admin/handler/RedirectClientByPathHandler.java | 22 +-
.../handler/RedirectClientBySubSystemHandler.java | 7 +-
.../admin/handler/RejectAllClientHandler.java | 8 +-
.../admin/handler/RejectClientByIpPortHandler.java | 7 +-
.../handler/RejectClientBySubSystemHandler.java | 18 +-
.../admin/handler/ShowClientBySystemHandler.java | 16 +-
.../runtime/admin/handler/ShowClientHandler.java | 13 +-
.../handler/ShowListenClientByTopicHandler.java | 14 +-
.../runtime/admin/handler/TCPClientHandler.java | 28 +-
.../runtime/admin/handler/TopicHandler.java | 24 +-
.../admin/handler/UpdateWebHookConfigHandler.java | 7 +-
.../eventmesh/runtime/boot/AbstractHTTPServer.java | 12 +-
.../runtime/boot/AbstractRemotingServer.java | 9 +-
.../eventmesh/runtime/boot/AbstractTCPServer.java | 7 +-
.../runtime/boot/EventMeshAdminBootstrap.java | 53 ++++
.../runtime/boot/EventMeshAdminServer.java | 299 +++++++++++++++++++++
.../eventmesh/runtime/boot/EventMeshServer.java | 38 ++-
.../controller/ClientManageControllerTest.java | 86 ------
.../QueryRecommendEventMeshHandlerTest.java | 4 +-
.../handler/RedirectClientByIpPortHandlerTest.java | 4 +-
.../handler/RedirectClientByPathHandlerTest.java | 4 +-
37 files changed, 626 insertions(+), 598 deletions(-)
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/ClientManageController.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/ClientManageController.java
deleted file mode 100644
index bf0c132a0..000000000
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/ClientManageController.java
+++ /dev/null
@@ -1,162 +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 org.apache.eventmesh.runtime.admin.controller;
-
-import org.apache.eventmesh.runtime.admin.handler.ConfigurationHandler;
-import org.apache.eventmesh.runtime.admin.handler.DeleteWebHookConfigHandler;
-import org.apache.eventmesh.runtime.admin.handler.EventHandler;
-import org.apache.eventmesh.runtime.admin.handler.GrpcClientHandler;
-import org.apache.eventmesh.runtime.admin.handler.HTTPClientHandler;
-import org.apache.eventmesh.runtime.admin.handler.InsertWebHookConfigHandler;
-import org.apache.eventmesh.runtime.admin.handler.MetaHandler;
-import org.apache.eventmesh.runtime.admin.handler.MetricsHandler;
-import
org.apache.eventmesh.runtime.admin.handler.QueryRecommendEventMeshHandler;
-import
org.apache.eventmesh.runtime.admin.handler.QueryWebHookConfigByIdHandler;
-import
org.apache.eventmesh.runtime.admin.handler.QueryWebHookConfigByManufacturerHandler;
-import
org.apache.eventmesh.runtime.admin.handler.RedirectClientByIpPortHandler;
-import org.apache.eventmesh.runtime.admin.handler.RedirectClientByPathHandler;
-import
org.apache.eventmesh.runtime.admin.handler.RedirectClientBySubSystemHandler;
-import org.apache.eventmesh.runtime.admin.handler.RejectAllClientHandler;
-import org.apache.eventmesh.runtime.admin.handler.RejectClientByIpPortHandler;
-import
org.apache.eventmesh.runtime.admin.handler.RejectClientBySubSystemHandler;
-import org.apache.eventmesh.runtime.admin.handler.ShowClientBySystemHandler;
-import org.apache.eventmesh.runtime.admin.handler.ShowClientHandler;
-import
org.apache.eventmesh.runtime.admin.handler.ShowListenClientByTopicHandler;
-import org.apache.eventmesh.runtime.admin.handler.TCPClientHandler;
-import org.apache.eventmesh.runtime.admin.handler.TopicHandler;
-import org.apache.eventmesh.runtime.admin.handler.UpdateWebHookConfigHandler;
-import org.apache.eventmesh.runtime.boot.EventMeshGrpcServer;
-import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
-import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
-import org.apache.eventmesh.runtime.meta.MetaStorage;
-import org.apache.eventmesh.webhook.admin.AdminWebHookConfigOperationManager;
-import org.apache.eventmesh.webhook.api.WebHookConfigOperation;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Objects;
-
-import com.sun.net.httpserver.HttpServer;
-
-import lombok.Setter;
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * This class is responsible for managing the client connections
- * and initializing the client handlers.
- * <p>
- * It starts the AdminController for managing the event store or MQ.
- */
-
-@SuppressWarnings("restriction")
-@Slf4j
-public class ClientManageController {
-
- private final EventMeshTCPServer eventMeshTCPServer;
-
- private final transient EventMeshHTTPServer eventMeshHTTPServer;
-
- private final transient EventMeshGrpcServer eventMeshGrpcServer;
-
- private final transient MetaStorage eventMeshMetaStorage;
-
- @Setter
- private AdminWebHookConfigOperationManager
adminWebHookConfigOperationManage;
-
- /**
- * Constructs a new ClientManageController with the given server instance.
- *
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param eventMeshHTTPServer the HTTP server instance of EventMesh
- * @param eventMeshGrpcServer the gRPC server instance of EventMesh
- * @param eventMeshMetaStorage the registry adaptor of EventMesh
- */
- public ClientManageController(EventMeshTCPServer eventMeshTCPServer,
- EventMeshHTTPServer eventMeshHTTPServer,
- EventMeshGrpcServer eventMeshGrpcServer,
- MetaStorage eventMeshMetaStorage) {
- this.eventMeshTCPServer = eventMeshTCPServer;
- this.eventMeshHTTPServer = eventMeshHTTPServer;
- this.eventMeshGrpcServer = eventMeshGrpcServer;
- this.eventMeshMetaStorage = eventMeshMetaStorage;
- }
-
- /**
- * Invoke this method to start this controller on the specified port.
- *
- * @throws IOException if an I/O error occurs while starting the server
- */
- public void start() throws IOException {
- // Get the server's admin port.
- int port =
eventMeshTCPServer.getEventMeshTCPConfiguration().getEventMeshServerAdminPort();
- // Create an HTTP server and bind it to the specified port.
- HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
-
- HttpHandlerManager httpHandlerManager = new HttpHandlerManager();
-
- // TODO: Optimized for automatic injection
-
- // Initialize the client handler and register it with the HTTP handler
manager.
- initClientHandler(eventMeshTCPServer, eventMeshHTTPServer,
- eventMeshGrpcServer, eventMeshMetaStorage, httpHandlerManager);
-
- // Register the handlers from the HTTP handler manager with the HTTP
server.
- httpHandlerManager.registerHttpHandler(server);
-
- server.start();
- log.info("ClientManageController start success, port:{}", port);
- }
-
- private void initClientHandler(EventMeshTCPServer eventMeshTCPServer,
- EventMeshHTTPServer eventMeshHTTPServer,
- EventMeshGrpcServer eventMeshGrpcServer,
- MetaStorage eventMeshMetaStorage,
- HttpHandlerManager httpHandlerManager) {
- new ShowClientHandler(eventMeshTCPServer, httpHandlerManager);
- new ShowClientBySystemHandler(eventMeshTCPServer, httpHandlerManager);
- new RejectAllClientHandler(eventMeshTCPServer, httpHandlerManager);
- new RejectClientByIpPortHandler(eventMeshTCPServer,
httpHandlerManager);
- new RejectClientBySubSystemHandler(eventMeshTCPServer,
httpHandlerManager);
- new RedirectClientBySubSystemHandler(eventMeshTCPServer,
httpHandlerManager);
- new RedirectClientByPathHandler(eventMeshTCPServer,
httpHandlerManager);
- new RedirectClientByIpPortHandler(eventMeshTCPServer,
httpHandlerManager);
- new ShowListenClientByTopicHandler(eventMeshTCPServer,
httpHandlerManager);
- new QueryRecommendEventMeshHandler(eventMeshTCPServer,
httpHandlerManager);
- new TCPClientHandler(eventMeshTCPServer, httpHandlerManager);
- new HTTPClientHandler(eventMeshHTTPServer, httpHandlerManager);
- new GrpcClientHandler(eventMeshGrpcServer, httpHandlerManager);
- new ConfigurationHandler(
- eventMeshTCPServer.getEventMeshTCPConfiguration(),
- eventMeshHTTPServer.getEventMeshHttpConfiguration(),
- eventMeshGrpcServer.getEventMeshGrpcConfiguration(),
httpHandlerManager);
- new MetricsHandler(eventMeshHTTPServer, eventMeshTCPServer,
httpHandlerManager);
- new
TopicHandler(eventMeshTCPServer.getEventMeshTCPConfiguration().getEventMeshStoragePluginType(),
httpHandlerManager);
- new
EventHandler(eventMeshTCPServer.getEventMeshTCPConfiguration().getEventMeshStoragePluginType(),
httpHandlerManager);
- new MetaHandler(eventMeshMetaStorage, httpHandlerManager);
-
- if
(Objects.nonNull(adminWebHookConfigOperationManage.getWebHookConfigOperation()))
{
- WebHookConfigOperation webHookConfigOperation =
adminWebHookConfigOperationManage.getWebHookConfigOperation();
- new InsertWebHookConfigHandler(webHookConfigOperation,
httpHandlerManager);
- new UpdateWebHookConfigHandler(webHookConfigOperation,
httpHandlerManager);
- new DeleteWebHookConfigHandler(webHookConfigOperation,
httpHandlerManager);
- new QueryWebHookConfigByIdHandler(webHookConfigOperation,
httpHandlerManager);
- new
QueryWebHookConfigByManufacturerHandler(webHookConfigOperation,
httpHandlerManager);
- }
- }
-
-}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/HttpHandlerManager.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/HttpHandlerManager.java
deleted file mode 100644
index 47557608f..000000000
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/HttpHandlerManager.java
+++ /dev/null
@@ -1,65 +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 org.apache.eventmesh.runtime.admin.controller;
-
-import org.apache.eventmesh.runtime.common.EventHttpHandler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.sun.net.httpserver.HttpHandler;
-import com.sun.net.httpserver.HttpServer;
-
-/**
- * This class manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@linkplain com.sun.net.httpserver.HttpServer HttpServer}.
- */
-
-public class HttpHandlerManager {
-
- private final List<HttpHandler> httpHandlers = new ArrayList<>();
-
- /**
- * Registers an HTTP handler.
- *
- * @param httpHandler The {@link HttpHandler} to be registered.
- * A handler which is invoked to process HTTP exchanges.
- * Each HTTP exchange is handled by one of these
handlers.
- */
- public void register(HttpHandler httpHandler) {
- this.httpHandlers.add(httpHandler);
- }
-
- /**
- * Registers multiple HTTP handlers to a given HttpServer.
- * <p>
- * Each HTTP handler is annotated with the {@link EventHttpHandler}
annotation,
- * which specifies the path where the handler should be registered.
- *
- * @param server A HttpServer object that is bound to an IP address and
port number
- * and listens for incoming TCP connections from clients on
this address.
- * The registered HTTP handlers will be associated with this
server.
- */
- public void registerHttpHandler(HttpServer server) {
- httpHandlers.forEach(httpHandler -> {
- EventHttpHandler eventHttpHandler =
httpHandler.getClass().getAnnotation(EventHttpHandler.class);
- server.createContext(eventHttpHandler.path(), httpHandler);
- });
-
- }
-}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java
index e13ce6d77..9e1165014 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java
@@ -17,8 +17,6 @@
package org.apache.eventmesh.runtime.admin.handler;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
-
import com.sun.net.httpserver.HttpHandler;
import lombok.Data;
@@ -33,10 +31,4 @@ import lombok.Data;
@Data
public abstract class AbstractHttpHandler implements HttpHandler {
- private final HttpHandlerManager httpHandlerManager;
-
- public AbstractHttpHandler(HttpHandlerManager httpHandlerManager) {
- this.httpHandlerManager = httpHandlerManager;
- this.httpHandlerManager.register(this);
- }
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AdminHandlerManager.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AdminHandlerManager.java
new file mode 100644
index 000000000..aabbe5bbe
--- /dev/null
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AdminHandlerManager.java
@@ -0,0 +1,98 @@
+/*
+ * 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.runtime.admin.handler;
+
+import org.apache.eventmesh.runtime.boot.EventMeshGrpcServer;
+import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
+import org.apache.eventmesh.runtime.boot.EventMeshServer;
+import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
+import org.apache.eventmesh.runtime.common.EventHttpHandler;
+import org.apache.eventmesh.runtime.meta.MetaStorage;
+import org.apache.eventmesh.webhook.admin.AdminWebHookConfigOperationManager;
+import org.apache.eventmesh.webhook.api.WebHookConfigOperation;
+
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+
+import com.sun.net.httpserver.HttpHandler;
+
+public class AdminHandlerManager {
+
+ private EventMeshTCPServer eventMeshTCPServer;
+
+ private EventMeshHTTPServer eventMeshHTTPServer;
+
+ private EventMeshGrpcServer eventMeshGrpcServer;
+
+ private MetaStorage eventMeshMetaStorage;
+
+ private AdminWebHookConfigOperationManager
adminWebHookConfigOperationManage;
+
+ private final Map<String, HttpHandler> httpHandlerMap = new
ConcurrentHashMap<>();
+
+ public AdminHandlerManager(EventMeshServer eventMeshServer) {
+ this.eventMeshGrpcServer = eventMeshServer.getEventMeshGrpcServer();
+ this.eventMeshHTTPServer = eventMeshServer.getEventMeshHTTPServer();
+ this.eventMeshTCPServer = eventMeshServer.getEventMeshTCPServer();
+ this.eventMeshMetaStorage = eventMeshServer.getMetaStorage();
+ this.adminWebHookConfigOperationManage =
eventMeshTCPServer.getAdminWebHookConfigOperationManage();
+ }
+
+ public void registerHttpHandler() {
+ initHandler(new ShowClientHandler(eventMeshTCPServer));
+ initHandler(new ShowClientBySystemHandler(eventMeshTCPServer));
+ initHandler(new RejectAllClientHandler(eventMeshTCPServer));
+ initHandler(new RejectClientByIpPortHandler(eventMeshTCPServer));
+ initHandler(new RejectClientBySubSystemHandler(eventMeshTCPServer));
+ initHandler(new RedirectClientBySubSystemHandler(eventMeshTCPServer));
+ initHandler(new RedirectClientByPathHandler(eventMeshTCPServer));
+ initHandler(new RedirectClientByIpPortHandler(eventMeshTCPServer));
+ initHandler(new ShowListenClientByTopicHandler(eventMeshTCPServer));
+ initHandler(new QueryRecommendEventMeshHandler(eventMeshTCPServer));
+ initHandler(new TCPClientHandler(eventMeshTCPServer));
+ initHandler(new HTTPClientHandler(eventMeshHTTPServer));
+ initHandler(new GrpcClientHandler(eventMeshGrpcServer));
+ initHandler(new ConfigurationHandler(
+ eventMeshTCPServer.getEventMeshTCPConfiguration(),
+ eventMeshHTTPServer.getEventMeshHttpConfiguration(),
+ eventMeshGrpcServer.getEventMeshGrpcConfiguration()));
+ initHandler(new MetricsHandler(eventMeshHTTPServer,
eventMeshTCPServer));
+ initHandler(new
TopicHandler(eventMeshTCPServer.getEventMeshTCPConfiguration().getEventMeshStoragePluginType()));
+ initHandler(new
EventHandler(eventMeshTCPServer.getEventMeshTCPConfiguration().getEventMeshStoragePluginType()));
+ initHandler(new MetaHandler(eventMeshMetaStorage));
+ if
(Objects.nonNull(adminWebHookConfigOperationManage.getWebHookConfigOperation()))
{
+ WebHookConfigOperation webHookConfigOperation =
adminWebHookConfigOperationManage.getWebHookConfigOperation();
+ initHandler(new
InsertWebHookConfigHandler(webHookConfigOperation));
+ initHandler(new
UpdateWebHookConfigHandler(webHookConfigOperation));
+ initHandler(new
DeleteWebHookConfigHandler(webHookConfigOperation));
+ initHandler(new
QueryWebHookConfigByIdHandler(webHookConfigOperation));
+ initHandler(new
QueryWebHookConfigByManufacturerHandler(webHookConfigOperation));
+ }
+ }
+
+ private void initHandler(HttpHandler httpHandler) {
+ EventHttpHandler eventHttpHandler =
httpHandler.getClass().getAnnotation(EventHttpHandler.class);
+ httpHandlerMap.putIfAbsent(eventHttpHandler.path(), httpHandler);
+ }
+
+ public Optional<HttpHandler> getHttpHandler(String path) {
+ return Optional.ofNullable(httpHandlerMap.get(path));
+ }
+}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ConfigurationHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ConfigurationHandler.java
index 3b0982a90..8d3747085 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ConfigurationHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ConfigurationHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.enums.HttpMethod;
import org.apache.eventmesh.common.utils.JsonUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.admin.response.Error;
import org.apache.eventmesh.runtime.admin.response.GetConfigurationResponse;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
@@ -40,11 +39,10 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the {@code /configuration} endpoint,
- * corresponding to the {@code eventmesh-dashboard} path {@code /}.
+ * This class handles the {@code /configuration} endpoint, corresponding to
the {@code eventmesh-dashboard} path {@code /}.
* <p>
- * This handler is responsible for retrieving the current configuration
information of the EventMesh node,
- * including service name, service environment, and listening ports for
various protocols.
+ * This handler is responsible for retrieving the current configuration
information of the EventMesh node, including service name, service
+ * environment, and listening ports for various protocols.
*
* @see AbstractHttpHandler
*/
@@ -60,18 +58,15 @@ public class ConfigurationHandler extends
AbstractHttpHandler {
/**
* Constructs a new instance with the provided configurations and HTTP
handler manager.
*
- * @param eventMeshTCPConfiguration the TCP configuration for EventMesh
+ * @param eventMeshTCPConfiguration the TCP configuration for EventMesh
* @param eventMeshHTTPConfiguration the HTTP configuration for EventMesh
* @param eventMeshGrpcConfiguration the gRPC configuration for EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
public ConfigurationHandler(
EventMeshTCPConfiguration eventMeshTCPConfiguration,
EventMeshHTTPConfiguration eventMeshHTTPConfiguration,
- EventMeshGrpcConfiguration eventMeshGrpcConfiguration,
- HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ EventMeshGrpcConfiguration eventMeshGrpcConfiguration) {
+ super();
this.eventMeshTCPConfiguration = eventMeshTCPConfiguration;
this.eventMeshHTTPConfiguration = eventMeshHTTPConfiguration;
this.eventMeshGrpcConfiguration = eventMeshGrpcConfiguration;
@@ -80,8 +75,7 @@ public class ConfigurationHandler extends AbstractHttpHandler
{
/**
* Handles the OPTIONS request first for {@code /configuration}.
* <p>
- * This method adds CORS (Cross-Origin Resource Sharing) response headers
to
- * the {@link HttpExchange} object and sends a 200 status code.
+ * This method adds CORS (Cross-Origin Resource Sharing) response headers
to the {@link HttpExchange} object and sends a 200 status code.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -150,8 +144,7 @@ public class ConfigurationHandler extends
AbstractHttpHandler {
/**
* Handles the HTTP requests for {@code /configuration}.
* <p>
- * It delegates the handling to {@code preflight()} or {@code get()}
methods
- * based on the request method type (OPTIONS or GET).
+ * It delegates the handling to {@code preflight()} or {@code get()}
methods based on the request method type (OPTIONS or GET).
* <p>
* This method is an implementation of {@linkplain
com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}
*
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/DeleteWebHookConfigHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/DeleteWebHookConfigHandler.java
index 59baa7bdc..0feaa748f 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/DeleteWebHookConfigHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/DeleteWebHookConfigHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.JsonUtils;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.webhook.api.WebHookConfig;
import org.apache.eventmesh.webhook.api.WebHookConfigOperation;
@@ -67,11 +66,9 @@ public class DeleteWebHookConfigHandler extends
AbstractHttpHandler {
* Constructs a new instance with the specified WebHook config operation
and HTTP handler manager.
*
* @param operation the WebHookConfigOperation implementation used to
delete the WebHook config
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
- public DeleteWebHookConfigHandler(WebHookConfigOperation operation,
HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public DeleteWebHookConfigHandler(WebHookConfigOperation operation) {
+ super();
this.operation = operation;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/EventHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/EventHandler.java
index d1d93bf2a..5646cea5a 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/EventHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/EventHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.enums.HttpMethod;
import org.apache.eventmesh.common.utils.JsonUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.admin.response.Error;
import org.apache.eventmesh.runtime.admin.utils.HttpExchangeUtils;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
@@ -72,13 +71,10 @@ public class EventHandler extends AbstractHttpHandler {
* Constructs a new instance with the specified connector plugin type and
HTTP handler manager.
*
* @param connectorPluginType The name of event storage connector plugin.
- * @param httpHandlerManager httpHandlerManager Manages the registration
of {@linkplain com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
public EventHandler(
- String connectorPluginType,
- HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ String connectorPluginType) {
+ super();
admin = new MQAdminWrapper(connectorPluginType);
try {
admin.init(null);
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/GrpcClientHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/GrpcClientHandler.java
index af16d9599..6970b302b 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/GrpcClientHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/GrpcClientHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.enums.HttpMethod;
import org.apache.eventmesh.common.utils.JsonUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.admin.request.DeleteGrpcClientRequest;
import org.apache.eventmesh.runtime.admin.response.Error;
import org.apache.eventmesh.runtime.admin.response.GetClientResponse;
@@ -46,12 +45,10 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the {@code /client/grpc} endpoint,
- * corresponding to the {@code eventmesh-dashboard} path {@code /grpc}.
+ * This class handles the {@code /client/grpc} endpoint, corresponding to the
{@code eventmesh-dashboard} path {@code /grpc}.
* <p>
- * It is responsible for managing operations on gRPC clients,
- * including retrieving the information list of connected gRPC clients
- * and deleting gRPC clients by disconnecting their connections based on the
provided host and port.
+ * It is responsible for managing operations on gRPC clients, including
retrieving the information list of connected gRPC clients and deleting gRPC
+ * clients by disconnecting their connections based on the provided host and
port.
*
* @see AbstractHttpHandler
*/
@@ -66,20 +63,17 @@ public class GrpcClientHandler extends AbstractHttpHandler {
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
* @param eventMeshGrpcServer the gRPC server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler} for an
- * {@link com.sun.net.httpserver.HttpServer
HttpServer}.
*/
public GrpcClientHandler(
- EventMeshGrpcServer eventMeshGrpcServer, HttpHandlerManager
httpHandlerManager) {
- super(httpHandlerManager);
+ EventMeshGrpcServer eventMeshGrpcServer) {
+ super();
this.eventMeshGrpcServer = eventMeshGrpcServer;
}
/**
* Handles the OPTIONS request first for {@code /client/grpc}.
* <p>
- * This method adds CORS (Cross-Origin Resource Sharing) response headers
to
- * the {@link HttpExchange} object and sends a 200 status code.
+ * This method adds CORS (Cross-Origin Resource Sharing) response headers
to the {@link HttpExchange} object and sends a 200 status code.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -97,8 +91,8 @@ public class GrpcClientHandler extends AbstractHttpHandler {
/**
* Handles the DELETE request for {@code /client/grpc}.
* <p>
- * This method deletes a connected gRPC client by disconnecting their
connections
- * based on the provided host and port, then returns {@code 200 OK}.
+ * This method deletes a connected gRPC client by disconnecting their
connections based on the provided host and port, then returns {@code 200
+ * OK}.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -215,8 +209,8 @@ public class GrpcClientHandler extends AbstractHttpHandler {
/**
* Handles the HTTP requests for {@code /client/grpc}.
* <p>
- * It delegates the handling to {@code preflight()}, {@code list()} or
{@code delete()} methods
- * based on the request method type (OPTIONS, GET or DELETE).
+ * It delegates the handling to {@code preflight()}, {@code list()} or
{@code delete()} methods based on the request method type (OPTIONS, GET or
+ * DELETE).
* <p>
* This method is an implementation of {@linkplain
com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}.
*
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/HTTPClientHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/HTTPClientHandler.java
index 03fd1e54a..c4173011e 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/HTTPClientHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/HTTPClientHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.enums.HttpMethod;
import org.apache.eventmesh.common.utils.JsonUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.admin.request.DeleteHTTPClientRequest;
import org.apache.eventmesh.runtime.admin.response.Error;
import org.apache.eventmesh.runtime.admin.response.GetClientResponse;
@@ -44,12 +43,10 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the {@code /client/http} endpoint,
- * corresponding to the {@code eventmesh-dashboard} path {@code /http}.
+ * This class handles the {@code /client/http} endpoint, corresponding to the
{@code eventmesh-dashboard} path {@code /http}.
* <p>
- * It is responsible for managing operations on HTTP clients,
- * including retrieving the information list of connected HTTP clients
- * and deleting HTTP clients by disconnecting their connections based on the
provided host and port.
+ * It is responsible for managing operations on HTTP clients, including
retrieving the information list of connected HTTP clients and deleting HTTP
+ * clients by disconnecting their connections based on the provided host and
port.
*
* @see AbstractHttpHandler
*/
@@ -64,20 +61,17 @@ public class HTTPClientHandler extends AbstractHttpHandler {
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
* @param eventMeshHTTPServer the HTTP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler} for an
- * {@link com.sun.net.httpserver.HttpServer
HttpServer}.
*/
public HTTPClientHandler(
- EventMeshHTTPServer eventMeshHTTPServer, HttpHandlerManager
httpHandlerManager) {
- super(httpHandlerManager);
+ EventMeshHTTPServer eventMeshHTTPServer) {
+ super();
this.eventMeshHTTPServer = eventMeshHTTPServer;
}
/**
* Handles the OPTIONS request first for {@code /client/http}.
* <p>
- * This method adds CORS (Cross-Origin Resource Sharing) response headers
to
- * the {@link HttpExchange} object and sends a 200 status code.
+ * This method adds CORS (Cross-Origin Resource Sharing) response headers
to the {@link HttpExchange} object and sends a 200 status code.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -95,8 +89,8 @@ public class HTTPClientHandler extends AbstractHttpHandler {
/**
* Handles the DELETE request for {@code /client/http}.
* <p>
- * This method deletes a connected HTTP client by disconnecting their
connections
- * based on the provided host and port, then returns {@code 200 OK}.
+ * This method deletes a connected HTTP client by disconnecting their
connections based on the provided host and port, then returns {@code 200
+ * OK}.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -206,8 +200,8 @@ public class HTTPClientHandler extends AbstractHttpHandler {
/**
* Handles the HTTP requests for {@code /client/http}.
* <p>
- * It delegates the handling to {@code preflight()}, {@code list()} or
{@code delete()} methods
- * based on the request method type (OPTIONS, GET or DELETE).
+ * It delegates the handling to {@code preflight()}, {@code list()} or
{@code delete()} methods based on the request method type (OPTIONS, GET or
+ * DELETE).
* <p>
* This method is an implementation of {@linkplain
com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}.
*
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/InsertWebHookConfigHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/InsertWebHookConfigHandler.java
index a7934146a..c9f8ed46f 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/InsertWebHookConfigHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/InsertWebHookConfigHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.JsonUtils;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.webhook.api.WebHookConfig;
import org.apache.eventmesh.webhook.api.WebHookConfigOperation;
@@ -68,11 +67,9 @@ public class InsertWebHookConfigHandler extends
AbstractHttpHandler {
* Constructs a new instance with the specified WebHook config operation
and HTTP handler manager.
*
* @param operation the WebHookConfigOperation implementation used to
insert the WebHook config
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
- public InsertWebHookConfigHandler(WebHookConfigOperation operation,
HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public InsertWebHookConfigHandler(WebHookConfigOperation operation) {
+ super();
this.operation = operation;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetaHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetaHandler.java
index d29dbd2d9..66c6deaa6 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetaHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetaHandler.java
@@ -21,7 +21,6 @@ import org.apache.eventmesh.api.meta.dto.EventMeshDataInfo;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.enums.HttpMethod;
import org.apache.eventmesh.common.utils.JsonUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.admin.response.Error;
import org.apache.eventmesh.runtime.admin.response.GetRegistryResponse;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
@@ -42,12 +41,10 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the {@code /registry} endpoint,
- * corresponding to the {@code eventmesh-dashboard} path {@code /registry}.
+ * This class handles the {@code /registry} endpoint, corresponding to the
{@code eventmesh-dashboard} path {@code /registry}.
* <p>
- * This handler is responsible for retrieving a list of EventMesh clusters
from the
- * {@link MetaStorage} object, encapsulate them into a list of {@link
GetRegistryResponse} objects,
- * and sort them by {@code EventMeshClusterName}.
+ * This handler is responsible for retrieving a list of EventMesh clusters
from the {@link MetaStorage} object, encapsulate them into a list of {@link
+ * GetRegistryResponse} objects, and sort them by {@code EventMeshClusterName}.
*
* @see AbstractHttpHandler
*/
@@ -59,23 +56,17 @@ public class MetaHandler extends AbstractHttpHandler {
private final MetaStorage eventMeshMetaStorage;
/**
- * Constructs a new instance with the specified {@link MetaStorage} and
{@link HttpHandlerManager}.
- *
- * @param eventMeshMetaStorage The {@link MetaStorage} instance used for
retrieving EventMesh cluster information.
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@linkplain
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshMetaStorage The {@link MetaStorage} instance used for
retrieving EventMesh cluster information.
*/
- public MetaHandler(MetaStorage eventMeshMetaStorage,
- HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public MetaHandler(MetaStorage eventMeshMetaStorage) {
+ super();
this.eventMeshMetaStorage = eventMeshMetaStorage;
}
/**
* Handles the OPTIONS request first for {@code /registry}.
* <p>
- * This method adds CORS (Cross-Origin Resource Sharing) response headers
to
- * the {@link HttpExchange} object and sends a 200 status code.
+ * This method adds CORS (Cross-Origin Resource Sharing) response headers
to the {@link HttpExchange} object and sends a 200 status code.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -144,8 +135,7 @@ public class MetaHandler extends AbstractHttpHandler {
/**
* Handles the HTTP requests for {@code /registry}.
* <p>
- * It delegates the handling to {@code preflight()} or {@code get()}
methods
- * based on the request method type (OPTIONS or GET).
+ * It delegates the handling to {@code preflight()} or {@code get()}
methods based on the request method type (OPTIONS or GET).
* <p>
* This method is an implementation of {@linkplain
com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}
*
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetricsHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetricsHandler.java
index 39f71f092..8eef2691a 100755
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetricsHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetricsHandler.java
@@ -22,7 +22,6 @@ import org.apache.eventmesh.common.enums.HttpMethod;
import org.apache.eventmesh.common.utils.JsonUtils;
import org.apache.eventmesh.metrics.api.model.HttpSummaryMetrics;
import org.apache.eventmesh.metrics.api.model.TcpSummaryMetrics;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.admin.response.Error;
import org.apache.eventmesh.runtime.admin.response.GetMetricsResponse;
import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
@@ -62,13 +61,10 @@ public class MetricsHandler extends AbstractHttpHandler {
*
* @param eventMeshHTTPServer the HTTP server instance of EventMesh
* @param eventMeshTcpServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
public MetricsHandler(EventMeshHTTPServer eventMeshHTTPServer,
- EventMeshTCPServer eventMeshTcpServer,
- HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ EventMeshTCPServer eventMeshTcpServer) {
+ super();
this.httpSummaryMetrics =
eventMeshHTTPServer.getMetrics().getSummaryMetrics();
this.tcpSummaryMetrics =
eventMeshTcpServer.getEventMeshTcpMonitor().getTcpSummaryMetrics();
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandler.java
index 77da3d33b..f8f7d166a 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandler.java
@@ -19,7 +19,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
@@ -37,9 +36,8 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the HTTP requests of {@code /eventMesh/recommend}
endpoint,
- * which is used to calculate and return the recommended EventMesh server node
to the client
- * based on the provided {@code group} and {@code purpose} parameters.
+ * This class handles the HTTP requests of {@code /eventMesh/recommend}
endpoint, which is used to calculate and return the recommended EventMesh
+ * server node to the client based on the provided {@code group} and {@code
purpose} parameters.
* <p>
* Parameters:
* <ul>
@@ -60,12 +58,10 @@ public class QueryRecommendEventMeshHandler extends
AbstractHttpHandler {
/**
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
*/
- public QueryRecommendEventMeshHandler(EventMeshTCPServer
eventMeshTCPServer, HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public QueryRecommendEventMeshHandler(EventMeshTCPServer
eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryWebHookConfigByIdHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryWebHookConfigByIdHandler.java
index a34ef811f..322d09597 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryWebHookConfigByIdHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryWebHookConfigByIdHandler.java
@@ -23,7 +23,6 @@ import static
org.apache.eventmesh.runtime.constants.EventMeshConstants.CONTENT_
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.JsonUtils;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.webhook.api.WebHookConfig;
import org.apache.eventmesh.webhook.api.WebHookConfigOperation;
@@ -37,9 +36,8 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the HTTP requests of {@code
/webhook/queryWebHookConfigById} endpoint
- * and returns the corresponding WebHook configuration information
- * based on the WebHook callback path specified in {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfig WebHookConfig}.
+ * This class handles the HTTP requests of {@code
/webhook/queryWebHookConfigById} endpoint and returns the corresponding WebHook
configuration
+ * information based on the WebHook callback path specified in {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfig WebHookConfig}.
* <p>
* Parameters:
* <ul>
@@ -77,11 +75,9 @@ public class QueryWebHookConfigByIdHandler extends
AbstractHttpHandler {
* Constructs a new instance with the specified WebHook config operation
and HTTP handler manager.
*
* @param operation the WebHookConfigOperation implementation used to
query the WebHook config
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
- public QueryWebHookConfigByIdHandler(WebHookConfigOperation operation,
HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public QueryWebHookConfigByIdHandler(WebHookConfigOperation operation) {
+ super();
this.operation = operation;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryWebHookConfigByManufacturerHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryWebHookConfigByManufacturerHandler.java
index 63c0f82ed..bd5050151 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryWebHookConfigByManufacturerHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryWebHookConfigByManufacturerHandler.java
@@ -23,7 +23,6 @@ import static
org.apache.eventmesh.runtime.constants.EventMeshConstants.CONTENT_
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.JsonUtils;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.webhook.api.WebHookConfig;
import org.apache.eventmesh.webhook.api.WebHookConfigOperation;
@@ -39,25 +38,22 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the HTTP requests of {@code
/webhook/queryWebHookConfigByManufacturer} endpoint
- * and returns a list of WebHook configurations
+ * This class handles the HTTP requests of {@code
/webhook/queryWebHookConfigByManufacturer} endpoint and returns a list of
WebHook configurations
* based on the WebHook manufacturer name (such as github) specified in
{@linkplain org.apache.eventmesh.webhook.api.WebHookConfig WebHookConfig}.
* <p>
- * The implementation of
- * {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfigOperation#queryWebHookConfigByManufacturer
WebHookConfigOperation}
+ * The implementation of {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfigOperation#queryWebHookConfigByManufacturer
WebHookConfigOperation}
* interface depends on the {@code eventMesh.webHook.operationMode}
configuration in {@code eventmesh.properties}.
* <p>
- * For example, when {@code eventMesh.webHook.operationMode=file}, It calls the
- * {@linkplain
org.apache.eventmesh.webhook.admin.FileWebHookConfigOperation#queryWebHookConfigByManufacturer
FileWebHookConfigOperation}
- * method as implementation to retrieve the WebHook configuration from a file;
+ * For example, when {@code eventMesh.webHook.operationMode=file}
+ * It calls the {@linkplain
org.apache.eventmesh.webhook.admin.FileWebHookConfigOperation#queryWebHookConfigByManufacturer
+ * FileWebHookConfigOperation} method as implementation to retrieve the
WebHook configuration from a file;
* <p>
- * When {@code eventMesh.webHook.operationMode=nacos}, It calls the
- * {@linkplain
org.apache.eventmesh.webhook.admin.NacosWebHookConfigOperation#queryWebHookConfigByManufacturer
NacosWebHookConfigOperation}
- * method as implementation to retrieve the WebHook configuration from Nacos.
+ * When {@code eventMesh.webHook.operationMode=nacos}
+ * It calls the {@linkplain
org.apache.eventmesh.webhook.admin.NacosWebHookConfigOperation#queryWebHookConfigByManufacturer
+ * NacosWebHookConfigOperation} method as implementation to retrieve the
WebHook configuration from Nacos.
* <p>
- * The
- * {@linkplain
org.apache.eventmesh.webhook.receive.storage.HookConfigOperationManager#queryWebHookConfigByManufacturer
HookConfigOperationManager}
- * , another implementation of {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfigOperation WebHookConfigOperation}
+ * The {@linkplain
org.apache.eventmesh.webhook.receive.storage.HookConfigOperationManager#queryWebHookConfigByManufacturer
+ * HookConfigOperationManager} , another implementation of {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfigOperation WebHookConfigOperation}
* interface, is not used for this endpoint.
*
* @see AbstractHttpHandler
@@ -74,15 +70,11 @@ public class QueryWebHookConfigByManufacturerHandler
extends AbstractHttpHandler
* Constructs a new instance with the specified WebHook config operation
and HTTP handler manager.
*
* @param operation the WebHookConfigOperation implementation used to
query the WebHook config
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
- public QueryWebHookConfigByManufacturerHandler(WebHookConfigOperation
operation,
- HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public QueryWebHookConfigByManufacturerHandler(WebHookConfigOperation
operation) {
+ super();
this.operation = operation;
Objects.requireNonNull(operation, "WebHookConfigOperation can not be
null");
- Objects.requireNonNull(httpHandlerManager, "HttpHandlerManager can not
be null");
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByIpPortHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByIpPortHandler.java
index bfd5ad496..3d04d96ae 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByIpPortHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByIpPortHandler.java
@@ -19,7 +19,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
@@ -40,9 +39,8 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the HTTP requests of {@code
/clientManage/redirectClientByIpPort} endpoint,
- * which is used to redirect matching clients to a target EventMesh server node
- * based on the provided IP address and port.
+ * This class handles the HTTP requests of {@code
/clientManage/redirectClientByIpPort} endpoint, which is used to redirect
matching clients to a
+ * target EventMesh server node based on the provided IP address and port.
* <p>
* The request must specify the client's and target EventMesh node's IP and
port.
* <p>
@@ -67,12 +65,10 @@ public class RedirectClientByIpPortHandler extends
AbstractHttpHandler {
/**
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
*/
- public RedirectClientByIpPortHandler(EventMeshTCPServer
eventMeshTCPServer, HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public RedirectClientByIpPortHandler(EventMeshTCPServer
eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
@@ -129,8 +125,8 @@ public class RedirectClientByIpPortHandler extends
AbstractHttpHandler {
+
"={}|destEventMeshPort={}", ip, port, destEventMeshIp,
destEventMeshPort, e);
result = String.format("redirectClientByIpPort fail!
sessionMap size {%d}, {clientIp=%s clientPort=%s "
- +
- "destEventMeshIp=%s destEventMeshPort=%s}, result {%s},
errorMsg : %s",
+ +
+ "destEventMeshIp=%s destEventMeshPort=%s}, result
{%s}, errorMsg : %s",
sessionMap.size(), ip, port, destEventMeshIp,
destEventMeshPort, redirectResult, e.getMessage());
NetUtils.sendSuccessResponseHeaders(httpExchange);
out.write(result.getBytes(Constants.DEFAULT_CHARSET));
@@ -138,8 +134,8 @@ public class RedirectClientByIpPortHandler extends
AbstractHttpHandler {
}
// Serialize the result of redirection into output stream
result = String.format("redirectClientByIpPort success! sessionMap
size {%d}, {ip=%s port=%s "
- +
- "destEventMeshIp=%s destEventMeshPort=%s}, result {%s} ",
+ +
+ "destEventMeshIp=%s destEventMeshPort=%s}, result {%s} ",
sessionMap.size(), ip, port, destEventMeshIp,
destEventMeshPort, redirectResult);
NetUtils.sendSuccessResponseHeaders(httpExchange);
out.write(result.getBytes(Constants.DEFAULT_CHARSET));
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java
index 0b9e8f52c..2badb64cb 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java
@@ -19,7 +19,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
@@ -40,9 +39,8 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the HTTP requests of {@code
/clientManage/redirectClientByPath} endpoint,
- * which is used to redirect matching clients to a target EventMesh server node
- * based on the provided client UserAgent path.
+ * This class handles the HTTP requests of {@code
/clientManage/redirectClientByPath} endpoint, which is used to redirect
matching clients to a target
+ * EventMesh server node based on the provided client UserAgent path.
* <p>
* The request must specify the client's path and target EventMesh node's IP
and port.
* <p>
@@ -66,12 +64,10 @@ public class RedirectClientByPathHandler extends
AbstractHttpHandler {
/**
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
*/
- public RedirectClientByPathHandler(EventMeshTCPServer eventMeshTCPServer,
HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public RedirectClientByPathHandler(EventMeshTCPServer eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
@@ -126,16 +122,16 @@ public class RedirectClientByPathHandler extends
AbstractHttpHandler {
+
"={}|destEventMeshPort={}", path, destEventMeshIp,
destEventMeshPort, e);
result = String.format("redirectClientByPath fail! sessionMap
size {%d}, {path=%s "
- +
- "destEventMeshIp=%s destEventMeshPort=%s}, result {%s},
errorMsg : %s",
+ +
+ "destEventMeshIp=%s destEventMeshPort=%s}, result
{%s}, errorMsg : %s",
sessionMap.size(), path, destEventMeshIp,
destEventMeshPort, redirectResult, e.getMessage());
NetUtils.sendSuccessResponseHeaders(httpExchange);
out.write(result.getBytes(Constants.DEFAULT_CHARSET));
return;
}
result = String.format("redirectClientByPath success! sessionMap
size {%d}, {path=%s "
- +
- "destEventMeshIp=%s destEventMeshPort=%s}, result {%s} ",
+ +
+ "destEventMeshIp=%s destEventMeshPort=%s}, result {%s} ",
sessionMap.size(), path, destEventMeshIp, destEventMeshPort,
redirectResult);
NetUtils.sendSuccessResponseHeaders(httpExchange);
out.write(result.getBytes(Constants.DEFAULT_CHARSET));
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientBySubSystemHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientBySubSystemHandler.java
index 6edc3fda8..6e7cd2590 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientBySubSystemHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientBySubSystemHandler.java
@@ -19,7 +19,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
@@ -68,11 +67,9 @@ public class RedirectClientBySubSystemHandler extends
AbstractHttpHandler {
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
* @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
- public RedirectClientBySubSystemHandler(final EventMeshTCPServer
eventMeshTCPServer, final HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public RedirectClientBySubSystemHandler(final EventMeshTCPServer
eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectAllClientHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectAllClientHandler.java
index 900090e5f..69748bc31 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectAllClientHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectAllClientHandler.java
@@ -19,7 +19,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import
org.apache.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcp2Client;
@@ -59,12 +58,9 @@ public class RejectAllClientHandler extends
AbstractHttpHandler {
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
* @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
- public RejectAllClientHandler(final EventMeshTCPServer eventMeshTCPServer,
- final HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public RejectAllClientHandler(final EventMeshTCPServer eventMeshTCPServer)
{
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectClientByIpPortHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectClientByIpPortHandler.java
index af2d5d132..63ea63ff6 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectClientByIpPortHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectClientByIpPortHandler.java
@@ -19,7 +19,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
@@ -70,11 +69,9 @@ public class RejectClientByIpPortHandler extends
AbstractHttpHandler {
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
* @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
- public RejectClientByIpPortHandler(EventMeshTCPServer eventMeshTCPServer,
HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public RejectClientByIpPortHandler(EventMeshTCPServer eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectClientBySubSystemHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectClientBySubSystemHandler.java
index 4ef5d882a..334f5718d 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectClientBySubSystemHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/RejectClientBySubSystemHandler.java
@@ -19,7 +19,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
@@ -43,9 +42,8 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the HTTP requests of {@code
/clientManage/rejectClientBySubSystem} endpoint,
- * which is used to reject a client connection
- * that matches the provided client subsystem id in a Data Communication
Network (DCN).
+ * This class handles the HTTP requests of {@code
/clientManage/rejectClientBySubSystem} endpoint, which is used to reject a
client connection that
+ * matches the provided client subsystem id in a Data Communication Network
(DCN).
* <p>
* The request must specify the client's subsystem id.
* <p>
@@ -67,12 +65,10 @@ public class RejectClientBySubSystemHandler extends
AbstractHttpHandler {
/**
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
*/
- public RejectClientBySubSystemHandler(EventMeshTCPServer
eventMeshTCPServer, HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public RejectClientBySubSystemHandler(EventMeshTCPServer
eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
@@ -133,8 +129,8 @@ public class RejectClientBySubSystemHandler extends
AbstractHttpHandler {
} catch (Exception e) {
log.error("clientManage|rejectClientBySubSystem|fail|subSystemId={}",
subSystem, e);
result = String.format("rejectClientBySubSystem fail!
sessionMap size {%d}, had reject {%s} , {"
- +
- "subSystemId=%s}, errorMsg : %s", sessionMap.size(),
printClients(successRemoteAddrs),
+ +
+ "subSystemId=%s}, errorMsg : %s", sessionMap.size(),
printClients(successRemoteAddrs),
subSystem, e.getMessage());
NetUtils.sendSuccessResponseHeaders(httpExchange);
out.write(result.getBytes(Constants.DEFAULT_CHARSET));
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientBySystemHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientBySystemHandler.java
index 3bebbcd3e..1222fd953 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientBySystemHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientBySystemHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
@@ -38,8 +37,7 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the HTTP requests of {@code
/clientManage/showClientBySystem} endpoint,
- * which is used to display connected clients information
+ * This class handles the HTTP requests of {@code
/clientManage/showClientBySystem} endpoint, which is used to display connected
clients information
* under a specific subsystem by subsystem id.
* <p>
* Parameters:
@@ -59,12 +57,10 @@ public class ShowClientBySystemHandler extends
AbstractHttpHandler {
/**
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
*/
- public ShowClientBySystemHandler(EventMeshTCPServer eventMeshTCPServer,
HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public ShowClientBySystemHandler(EventMeshTCPServer eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
@@ -95,8 +91,8 @@ public class ShowClientBySystemHandler extends
AbstractHttpHandler {
if (session.getClient().getSubsystem().equals(subSystem)) {
UserAgent userAgent = session.getClient();
result.append(String.format("pid=%s | ip=%s | port=%s
| path=%s | purpose=%s",
- userAgent.getPid(), userAgent.getHost(),
userAgent.getPort(),
- userAgent.getPath(), userAgent.getPurpose()))
+ userAgent.getPid(), userAgent.getHost(),
userAgent.getPort(),
+ userAgent.getPath(), userAgent.getPurpose()))
.append(newLine);
}
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientHandler.java
index 26b04fa4a..f660c754e 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientHandler.java
@@ -19,7 +19,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import
org.apache.eventmesh.runtime.core.protocol.tcp.client.group.ClientSessionGroupMapping;
@@ -39,8 +38,8 @@ import lombok.extern.slf4j.Slf4j;
/**
* This class handles the HTTP requests of {@code /clientManage/showClient}
endpoint.
* <p>
- * It is used to query information about all clients connected to the current
EventMesh server node
- * and to provide statistics on the number of clients in each subsystem.
+ * It is used to query information about all clients connected to the current
EventMesh server node and to provide statistics on the number of clients
+ * in each subsystem.
*
* @see AbstractHttpHandler
*/
@@ -54,12 +53,10 @@ public class ShowClientHandler extends AbstractHttpHandler {
/**
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
*/
- public ShowClientHandler(EventMeshTCPServer eventMeshTCPServer,
HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public ShowClientHandler(EventMeshTCPServer eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowListenClientByTopicHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowListenClientByTopicHandler.java
index c1b492b53..db24187d0 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowListenClientByTopicHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowListenClientByTopicHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
@@ -38,8 +37,7 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the HTTP requests of {@code
/clientManage/showListenClientByTopic} endpoint,
- * which is used to display clients information
+ * This class handles the HTTP requests of {@code
/clientManage/showListenClientByTopic} endpoint, which is used to display
clients information
* subscribed to a specific topic.
* <p>
* Parameters:
@@ -59,12 +57,10 @@ public class ShowListenClientByTopicHandler extends
AbstractHttpHandler {
/**
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
*/
- public ShowListenClientByTopicHandler(EventMeshTCPServer
eventMeshTCPServer, HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public ShowListenClientByTopicHandler(EventMeshTCPServer
eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
@@ -98,7 +94,7 @@ public class ShowListenClientByTopicHandler extends
AbstractHttpHandler {
for (Session session : listenSessions.values()) {
UserAgent userAgent = session.getClient();
result.append(String.format("pid=%s | ip=%s |
port=%s | path=%s | version=%s", userAgent.getPid(), userAgent
- .getHost(), userAgent.getPort(),
userAgent.getPath(), userAgent.getVersion()))
+ .getHost(), userAgent.getPort(),
userAgent.getPath(), userAgent.getVersion()))
.append(newLine);
}
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/TCPClientHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/TCPClientHandler.java
index ca89d204c..9697089ca 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/TCPClientHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/TCPClientHandler.java
@@ -21,7 +21,6 @@ import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.enums.HttpMethod;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.apache.eventmesh.common.utils.JsonUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.admin.request.DeleteTCPClientRequest;
import org.apache.eventmesh.runtime.admin.response.Error;
import org.apache.eventmesh.runtime.admin.response.GetClientResponse;
@@ -50,12 +49,10 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the {@code /client/tcp} endpoint,
- * corresponding to the {@code eventmesh-dashboard} path {@code /tcp}.
+ * This class handles the {@code /client/tcp} endpoint, corresponding to the
{@code eventmesh-dashboard} path {@code /tcp}.
* <p>
- * It is responsible for managing operations on TCP clients,
- * including retrieving the information list of connected TCP clients
- * and deleting TCP clients by disconnecting their connections based on the
provided host and port.
+ * It is responsible for managing operations on TCP clients, including
retrieving the information list of connected TCP clients and deleting TCP
+ * clients by disconnecting their connections based on the provided host and
port.
*
* @see AbstractHttpHandler
*/
@@ -69,21 +66,18 @@ public class TCPClientHandler extends AbstractHttpHandler {
/**
* Constructs a new instance with the provided server instance and HTTP
handler manager.
*
- * @param eventMeshTCPServer the TCP server instance of EventMesh
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
*/
public TCPClientHandler(
- EventMeshTCPServer eventMeshTCPServer, HttpHandlerManager
httpHandlerManager) {
- super(httpHandlerManager);
+ EventMeshTCPServer eventMeshTCPServer) {
+ super();
this.eventMeshTCPServer = eventMeshTCPServer;
}
/**
* Handles the OPTIONS request first for {@code /client/tcp}.
* <p>
- * This method adds CORS (Cross-Origin Resource Sharing) response headers
to
- * the {@link HttpExchange} object and sends a 200 status code.
+ * This method adds CORS (Cross-Origin Resource Sharing) response headers
to the {@link HttpExchange} object and sends a 200 status code.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -101,8 +95,8 @@ public class TCPClientHandler extends AbstractHttpHandler {
/**
* Handles the DELETE request for {@code /client/tcp}.
* <p>
- * This method deletes a connected TCP client by disconnecting their
connections
- * based on the provided host and port, then returns {@code 200 OK}.
+ * This method deletes a connected TCP client by disconnecting their
connections based on the provided host and port, then returns {@code 200
+ * OK}.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -213,8 +207,8 @@ public class TCPClientHandler extends AbstractHttpHandler {
/**
* Handles the HTTP requests for {@code /client/tcp}.
* <p>
- * It delegates the handling to {@code preflight()}, {@code list()} or
{@code delete()} methods
- * based on the request method type (OPTIONS, GET or DELETE).
+ * It delegates the handling to {@code preflight()}, {@code list()} or
{@code delete()} methods based on the request method type (OPTIONS, GET or
+ * DELETE).
* <p>
* This method is an implementation of {@linkplain
com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}.
*
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/TopicHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/TopicHandler.java
index ddbaa844d..26231c65a 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/TopicHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/TopicHandler.java
@@ -21,7 +21,6 @@ import org.apache.eventmesh.api.admin.TopicProperties;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.enums.HttpMethod;
import org.apache.eventmesh.common.utils.JsonUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.admin.request.CreateTopicRequest;
import org.apache.eventmesh.runtime.admin.request.DeleteTopicRequest;
import org.apache.eventmesh.runtime.admin.response.Error;
@@ -42,12 +41,11 @@ import com.sun.net.httpserver.HttpExchange;
import lombok.extern.slf4j.Slf4j;
/**
- * This class handles the {@code /topic} endpoint,
- * corresponding to the {@code eventmesh-dashboard} path {@code /topic},
- * including the "Create Topic" and "Remove" buttons.
+ * This class handles the {@code /topic} endpoint, corresponding to the {@code
eventmesh-dashboard} path {@code /topic}, including the "Create Topic"
+ * and "Remove" buttons.
* <p>
- * It provides functionality for managing topics, including retrieving the
list of topics (GET),
- * creating a new topic (POST), and deleting an existing topic (DELETE).
+ * It provides functionality for managing topics, including retrieving the
list of topics (GET), creating a new topic (POST), and deleting an existing
+ * topic (DELETE).
* <p>
* An instance of {@link MQAdminWrapper} is used to interact with the
messaging system.
*
@@ -65,13 +63,10 @@ public class TopicHandler extends AbstractHttpHandler {
* Constructs a new instance with the specified connector plugin type and
HTTP handler manager.
*
* @param connectorPluginType The name of event storage connector plugin.
- * @param httpHandlerManager httpHandlerManager Manages the registration
of {@linkplain com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
public TopicHandler(
- String connectorPluginType,
- HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ String connectorPluginType) {
+ super();
admin = new MQAdminWrapper(connectorPluginType);
try {
admin.init(null);
@@ -83,8 +78,7 @@ public class TopicHandler extends AbstractHttpHandler {
/**
* Handles the OPTIONS request first for {@code /topic}.
* <p>
- * This method adds CORS (Cross-Origin Resource Sharing) response headers
to
- * the {@link HttpExchange} object and sends a 200 status code.
+ * This method adds CORS (Cross-Origin Resource Sharing) response headers
to the {@link HttpExchange} object and sends a 200 status code.
*
* @param httpExchange the exchange containing the request from the client
and used to send the response
* @throws IOException if an I/O error occurs while handling the request
@@ -197,8 +191,8 @@ public class TopicHandler extends AbstractHttpHandler {
/**
* Handles the HTTP requests for {@code /topic}.
* <p>
- * It delegates the handling to {@code preflight()}, {@code get()}, {@code
post()} or {@code delete()} methods
- * based on the request method type (OPTIONS, GET, POST or DELETE).
+ * It delegates the handling to {@code preflight()}, {@code get()}, {@code
post()} or {@code delete()} methods based on the request method type
+ * (OPTIONS, GET, POST or DELETE).
* <p>
* This method is an implementation of {@linkplain
com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}.
*
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/UpdateWebHookConfigHandler.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/UpdateWebHookConfigHandler.java
index 66b4dd572..8c4579efa 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/UpdateWebHookConfigHandler.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/UpdateWebHookConfigHandler.java
@@ -20,7 +20,6 @@ package org.apache.eventmesh.runtime.admin.handler;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.JsonUtils;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.common.EventHttpHandler;
import org.apache.eventmesh.webhook.api.WebHookConfig;
import org.apache.eventmesh.webhook.api.WebHookConfigOperation;
@@ -67,11 +66,9 @@ public class UpdateWebHookConfigHandler extends
AbstractHttpHandler {
* Constructs a new instance with the specified WebHook config operation
and HTTP handler manager.
*
* @param operation the WebHookConfigOperation implementation used to
update the WebHook config
- * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
- * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
*/
- public UpdateWebHookConfigHandler(WebHookConfigOperation operation,
HttpHandlerManager httpHandlerManager) {
- super(httpHandlerManager);
+ public UpdateWebHookConfigHandler(WebHookConfigOperation operation) {
+ super();
this.operation = operation;
}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
index 3791bd61a..4ff086871 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
@@ -95,7 +95,6 @@ import lombok.extern.slf4j.Slf4j;
/**
* HTTP serves as the runtime module server for the protocol
- *
*/
@Slf4j
public abstract class AbstractHTTPServer extends AbstractRemotingServer {
@@ -110,7 +109,7 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
DiskAttribute.deleteOnExitTemporaryFile = false;
}
- private final transient AtomicBoolean started = new AtomicBoolean(false);
+ protected final transient AtomicBoolean started = new AtomicBoolean(false);
private final transient boolean useTLS;
private Boolean useTrace = false; // Determine whether trace is enabled
private static final int MAX_CONNECTIONS = 20_000;
@@ -139,13 +138,14 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
this.httpThreadPoolGroup = new
HTTPThreadPoolGroup(eventMeshHttpConfiguration);
}
- private void initSharableHandlers() {
+ protected void initSharableHandlers() {
httpConnectionHandler = new HttpConnectionHandler();
httpDispatcher = new HttpDispatcher();
}
public void init() throws Exception {
super.init("eventMesh-http");
+ initProducerManager();
httpThreadPoolGroup.initThreadPool();
}
@@ -415,8 +415,8 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
log.debug("{}", asyncContext.getResponse());
final Map<String, Object> traceMap =
asyncContext.getRequest().getHeader().toMap();
TraceUtils.finishSpanWithException(TraceUtils.prepareServerSpan(traceMap,
-
EventMeshTraceConstants.TRACE_UPSTREAM_EVENTMESH_SERVER_SPAN,
- false),
+
EventMeshTraceConstants.TRACE_UPSTREAM_EVENTMESH_SERVER_SPAN,
+ false),
traceMap,
EventMeshRetCode.EVENTMESH_REJECT_BY_PROCESSOR_ERROR.getErrMsg(), null);
}
@@ -481,7 +481,7 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
}
@Sharable
- private class HttpConnectionHandler extends ChannelDuplexHandler {
+ protected class HttpConnectionHandler extends ChannelDuplexHandler {
public final transient AtomicInteger connections = new
AtomicInteger(0);
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractRemotingServer.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractRemotingServer.java
index dd9a78435..fb0911662 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractRemotingServer.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractRemotingServer.java
@@ -22,6 +22,7 @@ import org.apache.eventmesh.common.utils.SystemUtils;
import org.apache.eventmesh.common.utils.ThreadUtils;
import org.apache.eventmesh.runtime.core.protocol.producer.ProducerManager;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
import io.netty.channel.EventLoopGroup;
@@ -48,7 +49,7 @@ public abstract class AbstractRemotingServer implements
RemotingServer {
private int port;
- private void buildBossGroup(final String threadPrefix) {
+ protected void buildBossGroup(final String threadPrefix) {
if (useEpoll()) {
bossGroup = new EpollEventLoopGroup(1, new
EventMeshThreadFactory(threadPrefix + "NettyEpoll-Boss", true));
} else {
@@ -82,7 +83,6 @@ public abstract class AbstractRemotingServer implements
RemotingServer {
buildBossGroup(threadPrefix);
buildIOGroup(threadPrefix);
buildWorkerGroup(threadPrefix);
- initProducerManager();
}
public void start() throws Exception {
@@ -94,8 +94,9 @@ public abstract class AbstractRemotingServer implements
RemotingServer {
bossGroup.shutdownGracefully();
log.info("shutdown bossGroup");
}
- producerManager.shutdown();
-
+ if (Objects.isNull(producerManager)) {
+ producerManager.shutdown();
+ }
ThreadUtils.randomPause(TimeUnit.SECONDS.toMillis(DEFAULT_SLEEP_SECONDS));
if (ioGroup != null) {
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractTCPServer.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractTCPServer.java
index 8e2739c18..ed5041559 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractTCPServer.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractTCPServer.java
@@ -75,7 +75,6 @@ import lombok.extern.slf4j.Slf4j;
/**
* TCP serves as the runtime module server for the protocol
- *
*/
@Slf4j
public class AbstractTCPServer extends AbstractRemotingServer {
@@ -110,6 +109,7 @@ public class AbstractTCPServer extends
AbstractRemotingServer {
public void init() throws Exception {
super.init("eventMesh-tcp");
+ initProducerManager();
tcpThreadPoolGroup.initThreadPool();
}
@@ -172,7 +172,6 @@ public class AbstractTCPServer extends
AbstractRemotingServer {
/**
* Registers the processors required by the runtime module
- *
*/
public void registerProcessor(final Command command, final TcpProcessor
processor,
final ThreadPoolExecutor executor) {
@@ -302,8 +301,8 @@ public class AbstractTCPServer extends
AbstractRemotingServer {
private boolean isNeedTrace(Command cmd) {
return eventMeshTCPConfiguration.isEventMeshServerTraceEnable()
&& (Command.REQUEST_TO_SERVER == cmd
- || Command.ASYNC_MESSAGE_TO_SERVER == cmd
- || Command.BROADCAST_MESSAGE_TO_SERVER == cmd);
+ || Command.ASYNC_MESSAGE_TO_SERVER == cmd
+ || Command.BROADCAST_MESSAGE_TO_SERVER == cmd);
}
private void writeToClient(Command cmd, Package pkg,
ChannelHandlerContext ctx, Exception e) {
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshAdminBootstrap.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshAdminBootstrap.java
new file mode 100644
index 000000000..e125475ec
--- /dev/null
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshAdminBootstrap.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.runtime.boot;
+
+public class EventMeshAdminBootstrap implements EventMeshBootstrap {
+
+ private EventMeshAdminServer eventMeshAdminServer;
+
+ private EventMeshServer eventMeshServer;
+
+ public EventMeshAdminBootstrap(EventMeshServer eventMeshServer) {
+ this.eventMeshServer = eventMeshServer;
+ }
+
+ @Override
+ public void init() throws Exception {
+ if (eventMeshServer != null) {
+ eventMeshAdminServer = new EventMeshAdminServer(eventMeshServer);
+ eventMeshAdminServer.init();
+ }
+
+ }
+
+ @Override
+ public void start() throws Exception {
+ if (eventMeshAdminServer != null) {
+ eventMeshAdminServer.start();
+ }
+
+ }
+
+ @Override
+ public void shutdown() throws Exception {
+ if (eventMeshAdminServer != null) {
+ eventMeshAdminServer.shutdown();
+ }
+ }
+}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshAdminServer.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshAdminServer.java
new file mode 100644
index 000000000..5fa1a1177
--- /dev/null
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshAdminServer.java
@@ -0,0 +1,299 @@
+/*
+ * 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.runtime.boot;
+
+import org.apache.eventmesh.runtime.admin.handler.AdminHandlerManager;
+import org.apache.eventmesh.runtime.util.HttpResponseUtils;
+import org.apache.eventmesh.runtime.util.Utils;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.Set;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.ChannelFutureListener;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.SimpleChannelInboundHandler;
+import io.netty.channel.epoll.EpollServerSocketChannel;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.handler.codec.http.DefaultFullHttpResponse;
+import io.netty.handler.codec.http.FullHttpRequest;
+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 com.sun.net.httpserver.Headers;
+import com.sun.net.httpserver.HttpContext;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpPrincipal;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class EventMeshAdminServer extends AbstractHTTPServer {
+
+ private HttpConnectionHandler httpConnectionHandler = new
HttpConnectionHandler();
+
+ private AdminHandlerManager adminHandlerManager;
+
+ public EventMeshAdminServer(EventMeshServer eventMeshServer) {
+
super(eventMeshServer.getEventMeshTCPServer().getEventMeshTCPConfiguration().getEventMeshServerAdminPort(),
false,
+
eventMeshServer.getEventMeshHTTPServer().getEventMeshHttpConfiguration());
+ adminHandlerManager = new AdminHandlerManager(eventMeshServer);
+ }
+
+
+ @Override
+ public void init() throws Exception {
+ super.init("eventMesh-admin-http");
+ adminHandlerManager.registerHttpHandler();
+ }
+
+ @Override
+ public void start() throws Exception {
+ final Thread thread = new Thread(() -> {
+ final ServerBootstrap bootstrap = new ServerBootstrap();
+ try {
+ bootstrap.group(this.getBossGroup(), this.getIoGroup())
+ .channel(useEpoll() ? EpollServerSocketChannel.class :
NioServerSocketChannel.class)
+ .childHandler(new AdminServerInitializer())
+ .childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE);
+
+ log.info("AdminHttpServer[port={}] started.", this.getPort());
+
+ bootstrap.bind(this.getPort())
+ .channel()
+ .closeFuture()
+ .sync();
+ } catch (Exception e) {
+ log.error("AdminHttpServer start error!", e);
+ try {
+ shutdown();
+ } catch (Exception ex) {
+ log.error("AdminHttpServer shutdown error!", ex);
+ }
+ System.exit(-1);
+ }
+ }, "EventMesh-http-server");
+ thread.setDaemon(true);
+ thread.start();
+ started.compareAndSet(false, true);
+ }
+
+ public void parseHttpRequest(ChannelHandlerContext ctx, HttpRequest
httpRequest) {
+ String uriStr = httpRequest.uri();
+ URI uri = URI.create(uriStr);
+ Optional<HttpHandler> httpHandlerOpt =
adminHandlerManager.getHttpHandler(uri.getPath());
+ if (httpHandlerOpt.isPresent()) {
+ try {
+ AdminHttpExchange adminHttpExchange = new
AdminHttpExchange(ctx, httpRequest);
+ httpHandlerOpt.get().handle(adminHttpExchange);
+ adminHttpExchange.writeAndFlash();
+ return;
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+
ctx.writeAndFlush(HttpResponseUtils.createInternalServerError()).addListener(ChannelFutureListener.CLOSE);
+ }
+ } else {
+
ctx.writeAndFlush(HttpResponseUtils.createNotFound()).addListener(ChannelFutureListener.CLOSE);
+ }
+ }
+
+ class AdminHttpExchange extends HttpExchange {
+
+
+ ChannelHandlerContext ctx;
+ Optional<FullHttpRequest> httpRequest;
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ Map<Integer, Long> responseCode = new HashMap<>();
+
+ Headers responseHeader = new Headers();
+
+ public AdminHttpExchange(ChannelHandlerContext ctx, HttpRequest
httpRequest) {
+ this.ctx = ctx;
+ if (httpRequest instanceof FullHttpRequest) {
+ this.httpRequest = Optional.ofNullable((FullHttpRequest)
httpRequest);
+ }
+ }
+
+ @Override
+ public Headers getRequestHeaders() {
+ Headers headers = new Headers();
+ httpRequest.ifPresent(e -> {
+ final Map<String, Object> headerMap = Utils.parseHttpHeader(e);
+ headerMap.putAll(headerMap);
+ });
+
+ return headers;
+ }
+
+ @Override
+ public Headers getResponseHeaders() {
+ return responseHeader;
+ }
+
+ @Override
+ public URI getRequestURI() {
+ if (httpRequest.isPresent()) {
+ return URI.create(httpRequest.get().uri());
+ }
+ return null;
+ }
+
+ @Override
+ public String getRequestMethod() {
+ if (httpRequest.isPresent()) {
+ return httpRequest.get().method().name();
+ }
+ return null;
+ }
+
+ @Override
+ public HttpContext getHttpContext() {
+ return null;
+ }
+
+ @Override
+ public void close() {
+
+ }
+
+ @Override
+ public InputStream getRequestBody() {
+ if (httpRequest.isPresent()) {
+ ByteBuf content = httpRequest.get().content();
+ byte[] bytes = new byte[content.readableBytes()];
+ try {
+ content.readBytes(bytes);
+ } finally {
+ content.release();
+ }
+ return new ByteArrayInputStream(bytes);
+ }
+ return new ByteArrayInputStream(new byte[0]);
+ }
+
+ @Override
+ public OutputStream getResponseBody() {
+ return outputStream;
+ }
+
+ @Override
+ public void sendResponseHeaders(int i, long l) throws IOException {
+ responseCode.put(i, l);
+ }
+
+ @Override
+ public InetSocketAddress getRemoteAddress() {
+ return null;
+ }
+
+ @Override
+ public int getResponseCode() {
+ Set<Entry<Integer, Long>> entries = responseCode.entrySet();
+ Optional<Entry<Integer, Long>> first =
entries.stream().findFirst();
+ return first.get().getKey();
+ }
+
+ @Override
+ public InetSocketAddress getLocalAddress() {
+ return null;
+ }
+
+ @Override
+ public String getProtocol() {
+ return null;
+ }
+
+ @Override
+ public Object getAttribute(String s) {
+ return null;
+ }
+
+ @Override
+ public void setAttribute(String s, Object o) {
+
+ }
+
+ @Override
+ public void setStreams(InputStream inputStream, OutputStream
outputStream) {
+
+ }
+
+ @Override
+ public HttpPrincipal getPrincipal() {
+ return null;
+ }
+
+ public void writeAndFlash() {
+ byte[] bytes = outputStream.toByteArray();
+ Headers responseHeaders = getResponseHeaders();
+ DefaultFullHttpResponse defaultFullHttpResponse =
+ new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.valueOf(getResponseCode()),
+ Unpooled.copiedBuffer(bytes));
+ responseHeaders.entrySet().stream().forEach(e -> {
+ defaultFullHttpResponse.headers().add(e.getKey(),
e.getValue());
+ });
+
ctx.writeAndFlush(defaultFullHttpResponse).addListener(ChannelFutureListener.CLOSE);
+ }
+ }
+
+ private class AdminServerInitializer extends
ChannelInitializer<SocketChannel> {
+
+
+ @Override
+ protected void initChannel(final SocketChannel channel) {
+ final ChannelPipeline pipeline = channel.pipeline();
+
+ pipeline.addLast(getWorkerGroup(),
+ new HttpRequestDecoder(),
+ new HttpResponseEncoder(),
+ httpConnectionHandler,
+ new HttpObjectAggregator(Integer.MAX_VALUE),
+ new SimpleChannelInboundHandler<HttpRequest>() {
+
+ @Override
+ protected void channelRead0(ChannelHandlerContext ctx,
HttpRequest msg) throws Exception {
+ parseHttpRequest(ctx, msg);
+ }
+ });
+ }
+ }
+
+}
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshServer.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshServer.java
index 11e16cab8..26e727406 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshServer.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshServer.java
@@ -26,7 +26,6 @@ import org.apache.eventmesh.common.config.ConfigService;
import org.apache.eventmesh.common.utils.AssertUtils;
import org.apache.eventmesh.common.utils.ConfigurationContextUtil;
import org.apache.eventmesh.runtime.acl.Acl;
-import org.apache.eventmesh.runtime.admin.controller.ClientManageController;
import org.apache.eventmesh.runtime.common.ServiceState;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
import
org.apache.eventmesh.runtime.core.protocol.http.producer.ProducerTopicManager;
@@ -57,7 +56,7 @@ public class EventMeshServer {
private final CommonConfiguration configuration;
- private transient ClientManageController clientManageController;
+ // private transient ClientManageController clientManageController;
private static final List<EventMeshBootstrap> BOOTSTRAP_LIST = new
CopyOnWriteArrayList<>();
@@ -65,6 +64,14 @@ public class EventMeshServer {
private static final ConfigService configService =
ConfigService.getInstance();
+ private EventMeshAdminBootstrap adminBootstrap;
+
+ private EventMeshTCPServer eventMeshTCPServer = null;
+
+ private EventMeshGrpcServer eventMeshGrpcServer = null;
+
+ private EventMeshHTTPServer eventMeshHTTPServer = null;
+
public EventMeshServer() {
// Initialize configuration
@@ -113,12 +120,6 @@ public class EventMeshServer {
trace.init();
}
- EventMeshTCPServer eventMeshTCPServer = null;
-
- EventMeshGrpcServer eventMeshGrpcServer = null;
-
- EventMeshHTTPServer eventMeshHTTPServer = null;
-
// server init
for (final EventMeshBootstrap eventMeshBootstrap : BOOTSTRAP_LIST) {
eventMeshBootstrap.init();
@@ -134,9 +135,8 @@ public class EventMeshServer {
}
if (Objects.nonNull(eventMeshTCPServer) &&
Objects.nonNull(eventMeshHTTPServer) && Objects.nonNull(eventMeshGrpcServer)) {
-
- clientManageController = new
ClientManageController(eventMeshTCPServer, eventMeshHTTPServer,
eventMeshGrpcServer, metaStorage);
-
clientManageController.setAdminWebHookConfigOperationManage(eventMeshTCPServer.getAdminWebHookConfigOperationManage());
+ adminBootstrap = new EventMeshAdminBootstrap(this);
+ adminBootstrap.init();
}
final String eventStore =
System.getProperty(EventMeshConstants.EVENT_STORE_PROPERTIES,
System.getenv(EventMeshConstants.EVENT_STORE_ENV));
@@ -164,8 +164,8 @@ public class EventMeshServer {
eventMeshBootstrap.start();
}
- if (Objects.nonNull(clientManageController)) {
- clientManageController.start();
+ if (Objects.nonNull(adminBootstrap)) {
+ adminBootstrap.start();
}
producerTopicManager.start();
serviceState = ServiceState.RUNNING;
@@ -228,4 +228,16 @@ public class EventMeshServer {
public CommonConfiguration getConfiguration() {
return configuration;
}
+
+ public EventMeshTCPServer getEventMeshTCPServer() {
+ return eventMeshTCPServer;
+ }
+
+ public EventMeshGrpcServer getEventMeshGrpcServer() {
+ return eventMeshGrpcServer;
+ }
+
+ public EventMeshHTTPServer getEventMeshHTTPServer() {
+ return eventMeshHTTPServer;
+ }
}
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/controller/ClientManageControllerTest.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/controller/ClientManageControllerTest.java
deleted file mode 100644
index 83773f22f..000000000
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/controller/ClientManageControllerTest.java
+++ /dev/null
@@ -1,86 +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 org.apache.eventmesh.runtime.admin.controller;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.apache.eventmesh.common.config.ConfigService;
-import org.apache.eventmesh.metrics.api.model.HttpSummaryMetrics;
-import org.apache.eventmesh.metrics.api.model.TcpSummaryMetrics;
-import org.apache.eventmesh.runtime.boot.EventMeshGrpcServer;
-import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
-import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
-import org.apache.eventmesh.runtime.configuration.EventMeshTCPConfiguration;
-import org.apache.eventmesh.runtime.meta.MetaStorage;
-import org.apache.eventmesh.runtime.metrics.http.HTTPMetricsServer;
-import org.apache.eventmesh.runtime.metrics.tcp.EventMeshTcpMonitor;
-import org.apache.eventmesh.webhook.admin.AdminWebHookConfigOperationManager;
-import org.apache.eventmesh.webhook.api.WebHookConfigOperation;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import com.sun.net.httpserver.HttpServer;
-
-public class ClientManageControllerTest {
-
- @Test
- public void testStart() throws Exception {
- ConfigService configService = ConfigService.getInstance();
- configService.setRootConfig("classPath://configuration.properties");
- EventMeshTCPConfiguration tcpConfiguration =
configService.buildConfigInstance(EventMeshTCPConfiguration.class);
-
- EventMeshTCPServer eventMeshTCPServer = mock(EventMeshTCPServer.class);
-
when(eventMeshTCPServer.getEventMeshTCPConfiguration()).thenReturn(tcpConfiguration);
-
- HttpSummaryMetrics httpSummaryMetrics = mock(HttpSummaryMetrics.class);
- HTTPMetricsServer metrics = mock(HTTPMetricsServer.class);
-
- EventMeshHTTPServer eventMeshHTTPServer =
mock(EventMeshHTTPServer.class);
- when(eventMeshHTTPServer.getMetrics()).thenReturn(metrics);
-
when(eventMeshHTTPServer.getMetrics().getSummaryMetrics()).thenReturn(httpSummaryMetrics);
-
- EventMeshTcpMonitor eventMeshTcpMonitor =
mock(EventMeshTcpMonitor.class);
- TcpSummaryMetrics tcpSummaryMetrics = mock(TcpSummaryMetrics.class);
-
when(eventMeshTCPServer.getEventMeshTcpMonitor()).thenReturn(eventMeshTcpMonitor);
-
when(eventMeshTCPServer.getEventMeshTcpMonitor().getTcpSummaryMetrics()).thenReturn(tcpSummaryMetrics);
-
- AdminWebHookConfigOperationManager adminWebHookConfigOperationManage =
mock(AdminWebHookConfigOperationManager.class);
- WebHookConfigOperation webHookConfigOperation =
mock(WebHookConfigOperation.class);
-
when(adminWebHookConfigOperationManage.getWebHookConfigOperation()).thenReturn(webHookConfigOperation);
-
- EventMeshGrpcServer eventMeshGrpcServer =
mock(EventMeshGrpcServer.class);
- MetaStorage metaStorage = mock(MetaStorage.class);
- ClientManageController controller = new
ClientManageController(eventMeshTCPServer,
- eventMeshHTTPServer, eventMeshGrpcServer, metaStorage);
-
controller.setAdminWebHookConfigOperationManage(adminWebHookConfigOperationManage);
-
-
eventMeshTCPServer.getEventMeshTCPConfiguration().setEventMeshStoragePluginType("standalone");
-
- try (MockedStatic<HttpServer> dummyStatic =
Mockito.mockStatic(HttpServer.class)) {
- HttpServer server = mock(HttpServer.class);
- dummyStatic.when(() -> HttpServer.create(any(),
anyInt())).thenReturn(server);
- Assertions.assertDoesNotThrow(controller::start);
- }
- }
-}
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandlerTest.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandlerTest.java
index 8377c5630..4a9753c73 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandlerTest.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandlerTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.mockConstruction;
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.when;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.configuration.EventMeshTCPConfiguration;
import
org.apache.eventmesh.runtime.core.protocol.tcp.client.recommend.EventMeshRecommendImpl;
@@ -58,8 +57,7 @@ public class QueryRecommendEventMeshHandlerTest {
OutputStream outputStream = new ByteArrayOutputStream();
HttpExchange httpExchange = mock(HttpExchange.class);
when(httpExchange.getRequestURI()).thenReturn(uri);
- HttpHandlerManager httpHandlerManager = new HttpHandlerManager();
- QueryRecommendEventMeshHandler handler = new
QueryRecommendEventMeshHandler(eventMeshTCPServer, httpHandlerManager);
+ QueryRecommendEventMeshHandler handler = new
QueryRecommendEventMeshHandler(eventMeshTCPServer);
String returnValue = "result";
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByIpPortHandlerTest.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByIpPortHandlerTest.java
index bafc971d8..3128c46f2 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByIpPortHandlerTest.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByIpPortHandlerTest.java
@@ -17,7 +17,6 @@
package org.apache.eventmesh.runtime.admin.handler;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import java.io.ByteArrayOutputStream;
@@ -39,8 +38,7 @@ public class RedirectClientByIpPortHandlerTest {
@BeforeEach
public void init() {
EventMeshTCPServer mockServer = Mockito.mock(EventMeshTCPServer.class);
- HttpHandlerManager httpHandlerManager = new HttpHandlerManager();
- redirectClientByIpPortHandler = new
RedirectClientByIpPortHandler(mockServer, httpHandlerManager);
+ redirectClientByIpPortHandler = new
RedirectClientByIpPortHandler(mockServer);
}
@Test
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandlerTest.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandlerTest.java
index b353d527b..27f1bc510 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandlerTest.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandlerTest.java
@@ -27,7 +27,6 @@ import static org.mockito.Mockito.when;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.apache.eventmesh.common.utils.NetUtils;
-import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
import org.apache.eventmesh.runtime.boot.EventMeshTCPServer;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
import
org.apache.eventmesh.runtime.core.protocol.tcp.client.EventMeshTcp2Client;
@@ -72,8 +71,7 @@ public class RedirectClientByPathHandlerTest {
ClientSessionGroupMapping mapping =
mock(ClientSessionGroupMapping.class);
when(eventMeshTCPServer.getClientSessionGroupMapping()).thenReturn(mapping);
- HttpHandlerManager httpHandlerManager = new HttpHandlerManager();
- RedirectClientByPathHandler redirectClientByPathHandler = new
RedirectClientByPathHandler(eventMeshTCPServer, httpHandlerManager);
+ RedirectClientByPathHandler redirectClientByPathHandler = new
RedirectClientByPathHandler(eventMeshTCPServer);
// mock session map
ConcurrentHashMap<InetSocketAddress, Session> sessionMap = new
ConcurrentHashMap<>();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]