Pil0tXia commented on code in PR #4837: URL: https://github.com/apache/eventmesh/pull/4837#discussion_r1568627722
########## eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/WebhookHttpSinkHandler.java: ########## @@ -83,20 +83,28 @@ private void doInitCallbackServer() { .path(this.webhookConfig.getCallbackPath()) .method(HttpMethod.POST) .produces("application/json") - .handler(ctx -> { - JSONObject callbackData = JSON.parseObject(ctx.body().asString()); - // store callback data - if (!this.callbackQueue.offer(callbackData)) { - log.error("Callback data is full, discard the data. Data: {}", callbackData); + .handler(ctx -> ctx.request().body().onComplete(ar -> { + if (ar.succeeded()) { + JSONObject callbackData = JSON.parseObject(ar.result().toString()); + // store callback data + if (!this.callbackQueue.offer(callbackData)) { + log.error("Callback data is full, discard the data. Data: {}", callbackData); + } else { + log.debug("Succeed to store callback data. Data: {}", callbackData); + } + // response 200 OK + ctx.response() + .putHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=utf-8") + .setStatusCode(HttpResponseStatus.OK.code()) + .end(); } else { - log.debug("Succeed to store callback data. Data: {}", callbackData); + log.error("Failed to parse callback data. ", ar.cause()); + ctx.response() + .putHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=utf-8") Review Comment: Conversation resolved in https://github.com/apache/eventmesh/pull/4837#issuecomment-2060655240 -- 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