How I built my first Kotlin-VertX-Hibernate stack

Hashnode Original

Comments (3)

Write your comment

Very informative. Thanks for writing this. :)

Write a reply...

A few small suggestions. Vert.x web Router has a 'blockingHandler' so that you don't need the extra calls to 'executeBlocking', and therefore have simpler code. Secondly, you can pass the instance of EntityManagerFactory to your verticles in a constructor and use it in any of your code as long as it is declared 'final'. Finally, you could have a 'Main class which starts your Vert.x app by calling 'Vertx.vert()' and do your blocking configuration (Hibernate/LiquiBase/etc...) before you deploy your first Verticle.

1: router.get("/blocking").blockingHandler { it.response().end(" Hello World :-) ") },

I've seen that, the plan is to replace the blocking code with Quasar fibers at some point, hence the reason I've been writing it like that, but valid point :-)

In Kotlin + Quasars the executeBlocking would be replaced with fiber @Suspendable { .. blocking code .. }.get()

2: that sounds awesome, I did not know that. Do you have an example of that?

3: any major benefit doing it this way?

Write a reply...

Nice share. But, why you did not put this on github?

You are more than welcome to publish it on Github, I'll share the link here as well.

Write a reply...

loading ...