Hi all,
To briefly introduce myself: I work as a software architect on a microservice-based application implemented mostly in Java. I discovered Vert.x fairly recently but it looks to me that it could be an awesome fit for our application.
Coming to my problem now. I’d like to be able to create a RESTful service that would be both:
Deployed as a standalone service leveraging the Vert.x HTTP server
Deployed as a Lambda function in AWS
I’m thinking about creating an adaptor that would create an HttpServerRequest based upon the HTTP request data passed in by AWS Lambda. I could then call router.accept(httpServerRequest) to process the request the same way as the standalone service would do. Here is some example code:
public class MyService implements com.amazonaws.services.lambda.runtime.RequestStreamHandler {
public void handleRequest(InputStream input, OutputStream output, Context context) {
Vertx vertx = Vertx.factory.vertx();
Router router = Router.router(vertx);
router.route("/some/path1").handler(routingContext -> {
// handle request
});
router.route("/some/path2").handler(routingContext -> {
// handle request
});
HttpServerRequest httpServerRequest = createHttpServerRequest(input, output, context);
router.accept(httpServerRequest);
}
HttpServerRequest createHttpServerRequest(InputStream input, OutputStream output, Context context) {
// TODO: Create a Vert.x HttpServerRequest here
}
}
I’m wondering, did somebody do something similar before? Would this be a good approach to solve the problem? I think that it would be great to allow Vert.x web applications to run as Lambda functions. Was searching the web but didn’t find any project that would make this work. I’d be very glad for your comments or suggestions.
Thanks,
Ales
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/4e4202d4-249e-4af5-91d1-0ea5b9732d73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 19 Oct 2017, at 08:07, Ales Nosek <ales....@gmail.com> wrote:
I solved my problem by creating a AWS Lambda adapter for Vert.x. If anybody is interested, you can find the project on GitHub: https://github.com/noseka1/vertx-aws-lambda
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/0260c73b-523e-40cc-bb68-ea83d441a31e%40googlegroups.com.