When I try to reply to do .response(), Vert.x throws an error:
java.lang.IllegalStateException: Response has already been writtenNotice, reply takes place within the consumer handler, not right in the body of the route handler.
Thank you.
router.post("/rbuilder").handler(routingContext -> {
if (!routingContext.failed()) {
vertx.eventBus().<JsonObject>consumer("riot.HttpEndpoint", message -> {
// //success
if(message.body().getString("Success") == "True")
{
routingContext.response().setStatusCode(200).end(new JsonObject().put("Success","True").encode());
}
// failure
else
{
routingContext.response().setStatusCode(400).end(new JsonObject().put("Success", "False").encode());
}
});