Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Ratpack 101 - GR8Conf 2015

1 936 vues

Publié le

Ratpack is a set of libraries for writing fast, efficient, evolvable and well tested HTTP applications written in Java 8 or any alternative JVM language that plays well with Java, such as Groovy.

The session will start with an introduction about Ratpack, and what makes it different from other popular frameworks like Grails or Vert.x, to name a few. Then, it will cover the fundamentals of the async programming model used in Ratpack applications, as well as other core concepts like handlers and the registry. Also, some of of the core modules ("plug-ins") will be described. Finally, it will cover how to test Ratpack applications using Groovy and Spock.

Publié dans : Logiciels
  • Soyez le premier à commenter

Ratpack 101 - GR8Conf 2015

  1. 1. @alvaro_sanchez Ratpack 101 @alvaro_sanchez Álvaro Sánchez-Mariscal - Web Architect
  2. 2. @alvaro_sanchez About me ● Passionate Software Developer. ○ Former BEA/Sun instructor, Groovy fanboy since 2006. ● Speaker at Codemotion, JavaLand, GeeCON, Spring IO, GR8Conf, GGX and Greach. ● Author of several Grails plugins. ● Working now at as a Web Architect.
  3. 3. @alvaro_sanchez About ● HTML5 platform for gambling games. ● We provide game developers a Javascript SDK. ● Server side logic and maths are handled by our industry certified game engines. ● Seamless integration with several casinos. ● Check out play.odobo.com and play for free!
  4. 4. @alvaro_sanchez Workshop requirements ● JDK 8 (both in command line and in your IDE). ● Git. ● Gradle. ● Groovy 2.4.1+ (on the command line). ● Lazybones installed via GVM.
  5. 5. @alvaro_sanchez Slides, code and workshop available ● Slides: ○ http://bit.ly/ratpack-101-slides ● Companion code: ○ http://bit.ly/ratpack-101-code ● Workshop: ○ http://alvarosanchez.github.io/ratpack-101
  6. 6. @alvaro_sanchez Agenda ● Introduction. ● The handlers chain. ● The context. ● Ratpack modules. ● Q&A.
  7. 7. @alvaro_sanchez Agenda ● Introduction. ● The handlers chain. ● The context. ● Ratpack modules. ● Q&A.
  8. 8. @alvaro_sanchez Agenda ● Introduction. ● The handlers chain. ● The context. ● Ratpack modules. ● Q&A.
  9. 9. @alvaro_sanchez Agenda ● Introduction. ● The handlers chain. ● The context. ● Ratpack modules. ● Q&A.
  10. 10. @alvaro_sanchez Agenda ● Introduction. ● The handlers chain. ● The context. ● Ratpack modules. ● Q&A.
  11. 11. @alvaro_sanchez Introduction ● Ratpack is: ○ A set of Java 8 libraries… ○ … lightweight, un-opinionated, Netty-based... ○ … for writing non-blocking HTTP applications… ○ … focused on performance and efficiency… ○ … with an emphasis on testability.. ○ … embracing Java 8 or Groovy as programming languages.
  12. 12. @alvaro_sanchez When to use Ratpack? ● For microservices. ● For high performance applications. ● For lightweight services (no container, batteries included).
  13. 13. @alvaro_sanchez Ratpack is developer friendly ● Startup in milliseconds. ● Development-time reloading with Spring Loaded. ● First-class support for functional testing.
  14. 14. @alvaro_sanchez Exercises 1. Hello World using a Groovy script (15 minutes). 2. Creating Ratpack projects with Lazybones and running them with Gradle (10 minutes).
  15. 15. @alvaro_sanchez Agenda ● Introduction. ● The handlers chain. ● The context. ● Ratpack modules. ● Q&A.
  16. 16. @alvaro_sanchez Handlers ● An incoming request is passed through the handler chain. ● A handler can: ○ Respond to the request. ○ Delegate to the next handler in the chain. ○ Insert more handlers in the chain and delegate to them.
  17. 17. @alvaro_sanchez Handlers ● Each handler is given a Context instance. ○ To interact with the request / response objects. ○ To access the registry. ○ Etc. ● Note that Ratpack is not based on the Servlet API.
  18. 18. @alvaro_sanchez Exercises 3. Working with handlers (30 minutes). 4. Testing Ratpack applications with Spock (20 minutes).
  19. 19. @alvaro_sanchez Agenda ● Introduction. ● The handlers chain. ● The context. ● Ratpack modules. ● Q&A.
  20. 20. @alvaro_sanchez The Context ● The Context provides: ○ Access to the HTTP Request and Response objects. ○ Interaction with other handlers through next() and insert() methods. ○ Access to objects in the registry.
  21. 21. @alvaro_sanchez The registry ● The context is also a Registry of objects. ● Handlers can store objects into the context for use by downstream handlers.
  22. 22. @alvaro_sanchez Exercises 5. Working with the context (20 minutes).
  23. 23. @alvaro_sanchez Agenda ● Introduction. ● The handlers chain. ● The context. ● Ratpack modules. ● Q&A.
  24. 24. @alvaro_sanchez Ratpack modules ● Ratpack can integrate with Google Guice for: ○ Dependency injection for services, etc. ○ Officially supported modules. ○ Reusing your own components as your modules.
  25. 25. @alvaro_sanchez Official modules (1/2) ● Benchmarks (JMH). ● Metrics. ● H2 Database. ● Handlebars. ● HikariCP JDBC pool. ● Hystrix. ● Jackson. ● New Relic. ● Pac4J. ● Reactor. ● Groovy Remote Control.
  26. 26. @alvaro_sanchez Official modules (2/2) ● RxJava. ● HTTP Sessions. ● Spring Boot. ● Thymeleaf.
  27. 27. @alvaro_sanchez Exercises 6. Using Ratpack modules with Google Guice (20 minutes).
  28. 28. @alvaro_sanchez Álvaro Sánchez-Mariscal Web Architect - odobo Images courtesy of Tak!

×