Example of starting vertx-vaadin explicitly from main() function
sanel opened this issue · 3 comments
Hi,
I'm currently evaluating Vaadin with vert.x combination and vertx-vaadin
looks like a perfect tool for that. I use Vaadin with Clojure, shipped in fatjar, which then manually starts Jetty and initializes VaadinServlet explicitly. The app is shipping built-in Jetty server and is run withjava -jar app.jar
, where everything is started from Java's main()
function.
Now, I'm looking for a similar approach with vertx-vaadin
, but I can't find an example of how to start vert.x web server manually and load vertx-vaadin
. Is this possible? In my case, I should be able to set a custom route for Vaadin app, as there are other routes outside of Vaadin context.
Also, reading from a blog post [1] @mcollovati, Vaadin with vertx-vaadin
might have distributed session support out of the box. Is this still a work in progress, or can it be considered production ready?
Hi, I do not have an example ready, but you can follow any Vertx example that deploys a verticle.
Basically, you should just need to create a Vertx instance and deploy the VaadinVerticle
(or a subclass).
Something like
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(VaadinVerticle.class.getName())
In addition, you may provide configuration to both the Vertx instance and the VaadinVerticle.
https://vertx.io/docs/vertx-core/java/#_specifying_options_when_creating_a_vertx_object
https://vertx.io/docs/vertx-core/java/#_deploying_verticles_programmatically
https://github.com/mcollovati/vertx-vaadin/blob/development/vertx-vaadin-flow-parent/vertx-vaadin-quarkus-extension/runtime/src/main/java/com/github/mcollovati/vertx/quarkus/VaadinVerticleDeployer.java (for Quarkus deployment, but may give an idea)
For FAT jars you can use the vert.x Launcher, configuring the main verticle class on in the MANIFEST.MF file
https://vertx.io/docs/vertx-core/java/#_using_the_launcher_in_fat_jars
About the distributed session support, it works for simple project, but I never tested with a real use case, so currently I could not define the support production ready.
An
BTW, thanks for the interest in the project!
Thank you very much for the details! Looking forward further playing with vertx-vaadin