Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Micro-services with Dropwizard

Micro-services with Dropwizard

Micro-services are a pattern for building small, single responsibility services that can be independently deployed and orchestrated as part of a larger services oriented architecture. Dropwizard is a Java framework for building RESTful webservices that are high-performance and developer friendly. It is mostly glue around stable and best-of-breed java libraries like Jersey, Jetty, and Jackson. We will talk about how Dropwizard addresses configuration, metrics, and logging.

Kyle Boon

March 27, 2014
Tweet

More Decks by Kyle Boon

Other Decks in Programming

Transcript

  1. Independance on various axes Select implementation and storage technology Test

    Deploy to production Recover from failure Monitor Horizontally scale Replace http://literateprogrammer.blogspot.com/2014/03/the-microservice-declaration-of.html
  2. The stack at BloomHealth Groovy for programming Grails for web

    applications Dropwizard for JSON web services Gradle for builds Swagger for Service Discovery Spock for testing Gatling for Performace/Load Testing Redis for Caching RabbitMQ for messaging
  3. What is Dropwizard Dropwizard is a heavily opinionated framework for

    building web services on the JVM. It is mostly glue around mature java libraries like Jetty, Jersey, Jackson and Guava. Dropwizard has out-of-the-box support for sophisticated configuration, application metrics, logging, operational tools, and much more, allowing you and your team to ship a production-quality HTTP+JSON web service in the shortest time possible.
  4. Who Created it? @coda As I've said before, the only

    reason Dropwizard exists at all is to provide opinions on what a service should be. I think they work better.It embeds Jetty because I think that works better.It uses Jackson because I think that works better.It uses Jersey because I think that works better.It has a single YAML configuration file because I think that works better. It wraps Logback because I think that works better.
  5. User dropwizard if you want get stuff done; don't use

    dropwizard if you want to shave yaks
  6. The Application Services are a collection of bundles, commands, healthchecks,

    tasks and resources. The service class defines all of the abilities of your application.
  7. The Resource Resources model what is exposed via your RESTful

    API. Dropwizard uses Jersey for this so these classes are mostly jersey annotations.
  8. The Representation Your POJOs will be turned into JSON via

    Jackson. Hibernate Validator lets you specify validation rules.
  9. Bundles Bundles are reusable blocks of behaviour designed to be

    reused across services. Assets, Hibernate and Liquibase are all implemented as Dropwizard Bundles.
  10. Commands Commands add options to the command line interface of

    your service. For example the server starts based on the 'server' command. Migrations run based on the 'db migrate' command. You might add your own command for running functional tests or seeding the database.
  11. Tasks Tasks are run time actions available over the administration

    port. Dropwizard ships with a garbage collection task. You might want to right a task to clean a cache by key.
  12. References - Microservices Martin Fowler on Micro-services Less micro more

    service What are micorservices? Presentation: Micro-services the Unix way Microservice declaration of independence
  13. References - Dropwizard Dropwizard User Guide Dropwizard User Group https://github.com/codahale/dropwizard

    Presentation about Dropwizard @ Yammer Presentation about Dropwizard @ Simple Coda Hale and Metrics Coda Hale and the Programming Ape