custom-header

Dropwizard / Scala / Kafka

Dropwizard / Scala / Kafka

I stumbled over Dropwizard during a conversation I conducted with guys from a big online travel platform. DW is their Java dropwizardMicroservice framework of choice.  Developers are encourage to work on ideas and improvements for their respective platform using DW. Their PAAS layer allows for direct integration which eases the pain of any other integration/deployment.

Coming from a Spring background, having enjoyed working with Grails, playing around with  Play/Scala for a while made me curious on what a framework like Dropwizard has to offer, what it could be used for and how it code make our work more efficient. My expectation for a lightweight framework can be narrowed down to:

  1. Simple to  setup, make first steps and operate to faciliate a steep learning curve (time-to-market)
  2. Small footprint and in the same time integration of matured and market standard libraries
  3. Active community with a solid base of contributors

My sample project can be found at Github. It allows to publish a message via an API endpoint to Kafka and let the same application consume and echo it out.

Let me get back to the three important points a framework has to cover and my result for Dropwizard:

easeOfUseI was starting with Java and it was actually a good start. Documentation looks good and it did not take me long to setup and run my first application with a single resource. Working with Jersey resources and views made me missing Springs MVC approach used for Grails where I simply did not care about objects i pushed into the view layer. Switching over to Scala eased my pain and facilitated configuration and resource entries being sometimes written as one-liners.

Adding a Kafka-Consumer required a bit more effort from my end as I was missing the basic understanding of how to embed thread based code the Dropwizard way. Codesamples I found introduced me to the lifecycle management and that rang the bell.

 

footprintThe sample application starts on my Macbook Air in below 7 seconds. The Grails equivalent can easily take up to 20. This is of course anything but a qualified evaluation but it gives me a good idea about the footprint.

 

 

 

 

supportLooks to me as this project has a good amount of followers and committers. This reminds me of a Java framework we used back in 2009 that had exactly one committer. Needless to say, that we did run into problems and it took a while to get shit resolved. Community here looks active and you can find many resources about it via Google.

 

 

 

 

 

takeAwayMy application barely scratches the surface of Dropwizard’s available functionalities. Topics like ‘Metrics’ and ‘Health Checks’ might just be two out of a number of topics one should look into as well. Even though my sample was quite small the way Dropwizard is organised and has been assembled is quite convincing. I would in general prefer the Scala way over the Java way even if its just for its conciseness of code. We will definitely use it as Microframework for selected use-cases.

 

Thanks for your time

 

 

 

 

 

Author: Thorsten Maus

Grown up in Berlin, Germany
Starting coding with 12 years on a Z80 processor
First contact with the internet in 1994 in Dublin

Living in Singapore

CTO Jobs:
helloPay (current)
Lazada (Special Projects)
Zalora
eDarling
iLove

Leave a Reply

Your email address will not be published. Required fields are marked *

Shares