How I built my first Kotlin-VertX-Hibernate stack

Hashnode Originals

Story 1.2K 3 Jan 2017

Write comment

  • Sort By :
  • Popular
  • Recent

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?

Very informative. Thanks for writing this. :)

Never miss a story from Jan Vladimir Mostert,
when you sign up for Hashnode. Learn more

loading ...