Production Ready Web Services with Dropwizard

11,109 views
10,748 views

Published on

Portland Java User Group
May 15, 2012

Published in: Technology
0 Comments
14 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
11,109
On SlideShare
0
From Embeds
0
Number of Embeds
182
Actions
Shares
0
Downloads
134
Comments
0
Likes
14
Embeds 0
No embeds

No notes for slide

Production Ready Web Services with Dropwizard

  1. 1. Production Ready WebServices with Dropwizard Portland Java User Group May 15, 2012 Sean Sullivan
  2. 2. http://twitter.com/hipsterhacker/status/193559234259075074
  3. 3. • Gilt Groupe• Dropwizard project• Dropwizard at Gilt
  4. 4. Gilt Groupe
  5. 5. online retailer
  6. 6. May 2011
  7. 7. April 2012
  8. 8. What does Gilt sell?
  9. 9. Apparel
  10. 10. Kids toys and apparel
  11. 11. Home furnishings
  12. 12. Food
  13. 13. Local deals
  14. 14. Travel
  15. 15. Gilt technology
  16. 16. Portland NYC Dublin
  17. 17. Service oriented architecture
  18. 18. email serviceproduct serviceshopping cart servicecheckout servicepayment service
  19. 19. internal “service framework” image credit: dealwithitportland.com
  20. 20. Dropwizard
  21. 21. “Dropwizard consists mostly of glue codeto automatically connect and configurethese components”• Jetty • logback• Jersey • Yammer Metrics• Jackson • Google Guava• JDBI • Hibernate Validator
  22. 22. Dropwizard modules• dropwizard-core • dropwizard-scala• dropwizard-client • dropwizard-views• dropwizard-db • dropwizard-testing• dropwizard-auth
  23. 23. <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
  24. 24. + Java services extendcom.yammer.dropwizard.Service
  25. 25. + Scala services extendcom.yammer.dropwizard.ScalaService
  26. 26. Service configuration
  27. 27. YAML + config class
  28. 28. import com.yammer.dropwizard.config.Configuration;public class MyServiceConfiguration extends Configuration { // your config stuff}
  29. 29. Other config• com.yammer.dropwizard.config.HttpConfiguration• com.yammer.dropwizard.config.LoggingConfiguration• com.yammer.dropwizard.db.DatabaseConfiguration
  30. 30. Hello world
  31. 31. Compile and run$ git clone git://github.com/sullis/dropwizard-helloworld.git$ cd dropwizard-helloworld$ mvn clean package$ ./bin/dev.sh
  32. 32. http://localhost:8080/helloworld?name=Portland
  33. 33. Dropwizard at Gilt
  34. 34. gift certificate servicefraud service
  35. 35. Gift certificate demo
  36. 36. dropwizard-gilt• Jackson ObjectMapper configuration• Log4j appender config• ZooKeeper registration• MessagingManager class
  37. 37. Hibernate Validator + Scala case classes https://groups.google.com/d/topic/dropwizard-user/sGEi3i8W1tY/discussion
  38. 38. https://twitter.com/#!/cowtowncoder/status/198167133887266816
  39. 39. SOA challenges• deployment• QA• monitoring• debugging
  40. 40. Questions?
  41. 41. THE END
  42. 42. Bonus slides
  43. 43. “Monitoring and QA are the same thing.Youd never think so untilyou try doing a big SOA. But when your service says "oh yes, Imfine", it may well be the case that the only thing still functioning inthe server is the little component that knows how to say "Imfine, roger roger, over and out" in a cheery droid voice. In order totell whether the service is actually responding, you have to makeindividual calls.The problem continues recursively until yourmonitoring is doing comprehensive semantics checking of yourentire range of services and data, at which point itsindistinguishable from automated QA” Steve Yegge, October 2011 http://bit.ly/pityk6
  44. 44. “If you have hundreds of services, and your code MUSTcommunicate with other groups code via these services, thenyou wont be able to find any of them without a service-discovery mechanism. And you cant have that without aservice registration mechanism, which itself is another service.So Amazon has a universal service registry where you can findout reflectively (programmatically) about every service, whatits APIs are, and also whether it is currently up, and where” Steve Yegge, October 2011 http://bit.ly/pityk6

×