-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Vertx to 4.x #282
Comments
For the "next" version I'd propose a change to the original interface: public interface FaasFunction<T> extends Function<Future<T>, RoutingContext>> {
default Future<Void> setup(Router router) {
return Future.SucceededFuture();
}
} This means that user only need to do: public class MyFunction implements FaasFunction<JsonObject> {
// if a user want to make use of other vert.x handlers, for example, BodyHandler ,JWTHandler
// just override the setup method, otherwise it is not needed as it is a default method
public Future<Void> setup(Router router) {
router.route().handler(BodyHandler.create());
return succeededFuture();
}
// here is the function
public Future<JsonObject> apply(RouttingContext ctx) {
return succeededFuture(new JsonObject("hello", "world"));
}
} The choice of using a function allows the entrypoint to use the The setup phase is optional, so users can use it to add features, for example it can allow us to remove the STATIC file handler and webroot from the template as it is now up to the user to decide how it works. A second optional method could be added to do |
For reference: https://vertx.io/docs/vertx-web/java/#_simple_responses Using this new API has many benefits to end users, such as, better error handling: .respond(rc -> {
throw new RuntimeException("Boom!");
} Will now be catched and returns either a It also allows composition, for example, using a client like redis to query the database and return the future of that call directly: return redis.send(HGETALL, "my-key"); In this case the response from the call is converted acording to the rules of return redis.send(HGETALL, "my-key")
.map(response -> ...); Can be used to convert from a non supported type to a web safe type (json, buffer, string)... |
Upgrade Vertx to 4.x
Expected Behaviour
We should have an option or change our main option for java11-vertx that means users can take advantage of the latest stable version of the Vertx framework
https://vertx.io/docs/vertx-web/java/
Current Behaviour
Still using 3.x
List All Possible Solutions and Workarounds
Which Solution Do You Recommend?
I prefer 1 for its simplicity, and I was able to change the entrypoint and it just worked.
However, @pmlopes (Vert.x maintainer) tells me that there are breaking changes in 3 -> 4, that could affect some users. I am not sure what those are and do not have examples. They do not affect our hello-world app.
Steps to Reproduce (for bugs)
Context
An OpenFaaS Pro customer is using this template and has forked it to update the Vertx version, and I've had several calls with other prospective customers who have expressed an interest.
The text was updated successfully, but these errors were encountered: