production ready web services with dropwizard
DESCRIPTION
Portland Java User GroupMay 15, 2012TRANSCRIPT
![Page 1: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/1.jpg)
Production Ready Web Services with Dropwizard
Portland Java User GroupMay 15, 2012Sean Sullivan
![Page 2: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/2.jpg)
http://twitter.com/hipsterhacker/status/193559234259075074
![Page 3: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/3.jpg)
![Page 4: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/4.jpg)
• Gilt Groupe
• Dropwizard project
• Dropwizard at Gilt
![Page 5: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/5.jpg)
Gilt Groupe
![Page 6: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/6.jpg)
online retailer
![Page 7: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/7.jpg)
May 2011
![Page 8: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/8.jpg)
April 2012
![Page 9: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/9.jpg)
What does Gilt sell?
![Page 10: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/10.jpg)
Apparel
![Page 11: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/11.jpg)
![Page 12: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/12.jpg)
![Page 13: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/13.jpg)
![Page 14: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/14.jpg)
Kids toys and apparel
![Page 15: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/15.jpg)
![Page 16: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/16.jpg)
Home furnishings
![Page 17: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/17.jpg)
![Page 18: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/18.jpg)
Food
![Page 19: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/19.jpg)
![Page 20: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/20.jpg)
Local deals
![Page 21: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/21.jpg)
![Page 22: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/22.jpg)
Travel
![Page 23: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/23.jpg)
![Page 24: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/24.jpg)
Gilt technology
![Page 25: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/25.jpg)
Portland NYC Dublin
![Page 26: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/26.jpg)
![Page 27: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/27.jpg)
Service oriented architecture
![Page 28: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/28.jpg)
shopping cart service
checkout service
email service
payment service
product service
![Page 29: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/29.jpg)
internal “service framework”
image credit: dealwithitportland.com
![Page 30: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/30.jpg)
Dropwizard
![Page 31: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/31.jpg)
![Page 32: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/32.jpg)
![Page 33: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/33.jpg)
• Jetty
• Jersey
• Jackson
• JDBI
• logback
• Yammer Metrics
• Google Guava
• Hibernate Validator
“Dropwizard consists mostly of glue code to automatically connect and configure these components”
![Page 34: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/34.jpg)
Dropwizard modules
• dropwizard-core
• dropwizard-client
• dropwizard-db
• dropwizard-auth
• dropwizard-scala
• dropwizard-views
• dropwizard-testing
![Page 35: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/35.jpg)
<dependencies> <dependency> <groupId>com.yammer.dropwizard</groupId> <artifactId>dropwizard-core</artifactId> <version>0.4.0</version> </dependency> <dependency> <groupId>com.yammer.dropwizard</groupId> <artifactId>dropwizard-scala</artifactId> <version>0.4.0</version> </dependency></dependencies>
Maven pom.xml
![Page 36: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/36.jpg)
Java services extend com.yammer.dropwizard.Service
+
![Page 37: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/37.jpg)
Scala services extend com.yammer.dropwizard.ScalaService
+
![Page 38: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/38.jpg)
Service configuration
![Page 39: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/39.jpg)
YAML + config class
![Page 40: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/40.jpg)
import com.yammer.dropwizard.config.Configuration;
public class MyServiceConfiguration
extends Configuration {
// your config stuff
}
![Page 41: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/41.jpg)
Other config
• com.yammer.dropwizard.config.HttpConfiguration
• com.yammer.dropwizard.config.LoggingConfiguration
• com.yammer.dropwizard.db.DatabaseConfiguration
![Page 42: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/42.jpg)
Hello world
![Page 43: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/43.jpg)
![Page 44: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/44.jpg)
$ git clone git://github.com/sullis/dropwizard-helloworld.git
$ cd dropwizard-helloworld
$ mvn clean package
$ ./bin/dev.sh
Compile and run
![Page 45: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/45.jpg)
http://localhost:8080/helloworld?name=Portland
![Page 46: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/46.jpg)
Dropwizard at Gilt
![Page 47: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/47.jpg)
gift certificate service
fraud service
![Page 48: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/48.jpg)
Gift certificate demo
![Page 49: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/49.jpg)
• Jackson ObjectMapper configuration
• Log4j appender config
• ZooKeeper registration
• MessagingManager class
dropwizard-gilt
![Page 50: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/50.jpg)
https://groups.google.com/d/topic/dropwizard-user/sGEi3i8W1tY/discussion
Hibernate Validator + Scala case classes
![Page 51: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/51.jpg)
https://twitter.com/#!/cowtowncoder/status/198167133887266816
![Page 52: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/52.jpg)
SOA challenges
• deployment
• QA
• monitoring
• debugging
![Page 53: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/53.jpg)
Questions?
![Page 54: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/54.jpg)
THE END
![Page 55: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/55.jpg)
Bonus slides
![Page 56: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/56.jpg)
“Monitoring and QA are the same thing. You'd never think so until you try doing a big SOA. But when your service says "oh yes, I'm fine", it may well be the case that the only thing still functioning in the server is the little component that knows how to say "I'm fine, roger roger, over and out" in a cheery droid voice. In order to tell whether the service is actually responding, you have to make individual calls. The problem continues recursively until your monitoring is doing comprehensive semantics checking of your entire range of services and data, at which point it's indistinguishable from automated QA”
http://bit.ly/pityk6Steve Yegge, October 2011
![Page 57: Production Ready Web Services with Dropwizard](https://reader034.vdocument.in/reader034/viewer/2022051611/54b7609f4a7959b0558b45ad/html5/thumbnails/57.jpg)
http://bit.ly/pityk6Steve Yegge, October 2011
“If you have hundreds of services, and your code MUST communicate with other groups' code via these services, then you won't be able to find any of them without a service-discovery mechanism. And you can't have that without a service registration mechanism, which itself is another service. So Amazon has a universal service registry where you can find out reflectively (programmatically) about every service, what its APIs are, and also whether it is currently up, and where”