cnzakii commented on code in PR #4837:
URL: https://github.com/apache/eventmesh/pull/4837#discussion_r1581998380


##########
eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/CommonHttpSinkHandler.java:
##########
@@ -114,78 +100,70 @@ private void doInitWebClient() {
     }
 
 
+    /**
+     * Handles a ConnectRecord by sending it asynchronously to all configured 
URLs.
+     *
+     * @param record the ConnectRecord to handle
+     */
+    @Override
+    public void multiHandle(ConnectRecord record) {
+        for (URI url : this.urls) {
+            // convert ConnectRecord to HttpConnectRecord
+            String type = String.format("%s.%s.%s", 
connectorConfig.getConnectorName(), url.getScheme(), "common");
+            HttpConnectRecord httpConnectRecord = 
HttpConnectRecord.convertConnectRecord(record, type);
+            handle(url, httpConnectRecord);
+        }
+    }
+
+
+    /**
+     * Sends the HttpConnectRecord to the specified URL using WebClient.
+     *
+     * @param url               the URL to send the HttpConnectRecord
+     * @param httpConnectRecord the HttpConnectRecord to send
+     * @return the Future of the HTTP request
+     */
     @Override
-    public void handle(ConnectRecord record) {
+    public Future<HttpResponse<Buffer>> handle(URI url, HttpConnectRecord 
httpConnectRecord) {
         // create headers
         MultiMap headers = HttpHeaders.headers()
+            .set(HttpHeaderNames.CONTENT_TYPE, "application/json; 
charset=utf-8")
             .set(HttpHeaderNames.ACCEPT, "application/json; charset=utf-8");

Review Comment:
   In fact, `Vertx` has already handled this for us by default. Unless we need 
to explicitly define a specific value for the `user-agent`, there's no need to 
do so.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@eventmesh.apache.org
For additional commands, e-mail: issues-h...@eventmesh.apache.org

Reply via email to