Ever since I decided to learn about the Java Ecosystem, I have been wanting to try out something practical. May be write a small app in Java and see how the experience would be. I came across a framework called Eclipse Vert.x few months back and decided to give it a try. So I ended up reading its documentation for few weekends and today morning. I am feeling a bit comfortable to write some code on Vert.x finally. Lets see how it goes!
Eclipse Vert.x is a tool-kit for building reactive applications on the JVM.
The main reasons to choose Vert.x:
It is polyglot, I suppose “x” in Vert.x stands for any supported programming language.
It has awesome documentation.
Gives the bare minimum and could be extended as we like.
Vert.x is a toolkit, not an opinionated framework where we force you to do things in a certain way.
Event bus as communication medium between services. (More on this later, if possible)
Lets say, I am trying to build a simple service that does CRUD of a table in a database. I call this table challenges. Here is a thought process on how this could be implemented.
Bootstrap
Let me start writing some code now. I am using http://start.vertx.io/ to get a template project.
Coming from a JavaScript background, it feels very weird to download starter projects from webpages as zip packages. In the JS ecosystem, we usually have this baked into command line tools.
It didn’t quite workout. I was able to run the sample web server verticle at least.
I am finally able to get autocomplete support, after fiddling for 15 minutes between IntelliJ IDEA, Eclipse, Atom, and VS Code.
TestOptions options = new TestOptions().addReporter(new ReportOptions().setTo("console")); suite.run(options); } }
Running the test using vertx test TestMainVerticle.java resulted in my tests getting passed.
1 2 3 4 5 6 7 8 9 10 11 12
Begin test suite challenges_events Begin test suite challenges_events Begin test publish events Begin test publish events challenges.create -> messagecreate payload challenges.update -> messageupdate payload challenges.delete -> messagedelete payload Passed publish events Passed publish events End test suite challenges_events , run: 1, Failures: 0, Errors: 0 End test suite challenges_events , run: 1, Failures: 0, Errors: 0 Succeeded in deploying verticle
(no idea why “Begin test suite challenges_events” is being printed twice.)
Anyways, I have a basic setup for my application ready. I hope to complete my handler logics afterwards. Bye until then!