Slide 1

Slide 1 text

Dropwizard production ready restful web services…

Slide 2

Slide 2 text

... for java … for java

Slide 3

Slide 3 text

preamble … the case for dropwizard

Slide 4

Slide 4 text

Dropwizard is an exemplar for ops-friendly, self contained, high performing, framework-less web service building technologies

Slide 5

Slide 5 text

… written in java

Slide 6

Slide 6 text

The concepts, principles & patterns contained herein can and should be applied to any services you build irrespective of technology or language

Slide 7

Slide 7 text

“micro service architecture” bit.ly/187C3Le

Slide 8

Slide 8 text

The rise of real service oriented architecture has meant that services are now an acceptable level of abstraction for defining system features

Slide 9

Slide 9 text

“ the world needs devops”

Slide 10

Slide 10 text

develop ⇝ deploy ⇝ disaster a typical release pipeline

Slide 11

Slide 11 text

When things go smoothly our initial reaction is one of surprise followed by suspicion

Slide 12

Slide 12 text

develop ⇝ deploy ⇝ disaster its their fault! they don’t get it! what the hell is this

Slide 13

Slide 13 text

news flash!

Slide 14

Slide 14 text

You are not writing code for your own gratification

Slide 15

Slide 15 text

You are trying to make others lives better

Slide 16

Slide 16 text

Your code and infrastructure will fail a lot

Slide 17

Slide 17 text

You are not in competition with other departments

Slide 18

Slide 18 text

You need a shared understanding of system behaviour

Slide 19

Slide 19 text

DEAL WITH IT!

Slide 20

Slide 20 text

Dropwizard provides a set of features that enable you to build systems capable of adapting to, both, a changing business and operational domain

Slide 21

Slide 21 text

Dropwizard the actual topic of the talk

Slide 22

Slide 22 text

Dropwizard is a Java framework for developing ops-friendly, high- performance, RESTful web services. http://dropwizard.io

Slide 23

Slide 23 text

A damn simple library for building production-ready RESTful web services github.com/dropwizard/dropwizard

Slide 24

Slide 24 text

It's a little bit of opinionated glue code which bangs together a set of libraries which have historically not sucked github.com/dropwizard/dropwizard

Slide 25

Slide 25 text

Jetty Jersey Jackson Metrics HTTP Library REST Library JSON Processor Instrumentation

Slide 26

Slide 26 text

Guava Immutable Collections & Utils Logback Freemarker & Mustache JodaTime Hibernate Validator JDBI & Liquibase Logging Validation Data Access & Migration Templating Non-Terrible Time

Slide 27

Slide 27 text

- Java is Java - Annotations are awful - Documentation is dispersed The “Nobody’s Perfect”

Slide 28

Slide 28 text

1. Create Configuration YML & Class 2. Create the Service 3. Create the Representation 4. Create & Register the Resource 5. Build & Run Lets Build a Service!!!

Slide 29

Slide 29 text

I could have done this with Rails, Sinatra, Spring, Play, Finagle, Express, Nancy.… So What?

Slide 30

Slide 30 text

The Admin Server Metrics Healthchecks

Slide 31

Slide 31 text

class DBManager implements Managed { public void start() { … } public void stop() { … } } // register in Service.initialize() environment.manage(myDBManager) Managed Objects

Slide 32

Slide 32 text

Commands // register in Service.initalize() bootstrap.addCommand(myCommand) > java -jar app.jar dingus class DingusCommand implements Command { public void configure(parser) { … } public void run(bootstrap, ns) { … } }

Slide 33

Slide 33 text

Tasks // register in Service.run() environment.addTask(myTask) > curl -X POST http://server/tasks/dingus class DingusTask implements Task { public void execute(params, out) { … } }

Slide 34

Slide 34 text

Bundles @Override public void initialize(bootstrap) { bootstrap.addBundle( new AssetsBundle("/assets/", "/")); } Reusable modules of functionality

Slide 35

Slide 35 text

import static com.yammer.dropwizard .testing.JsonHelpers.*; Testing (Fixtures) ! jsonFixture(“fixtures/person.json”) ! fromJson(myFixture, Person.class) ! asJson(person)

Slide 36

Slide 36 text

Testing (Resources) client().resource(“user/1”).get(User.class) public class MyTest extends ResourceTest { ! @Override protected void setUpResources() { addResource(...); } }

Slide 37

Slide 37 text

Views Data Access Authentication Migrations Banners etc… More Other Things & Stuff

Slide 38

Slide 38 text

Dropwizard production ready restful web services…