Today almost every product has an API, to integrate in other products or to made the data available to the outside world. Most API’s are using traditional patterns and technology. With the rise of Angular, React and other modern frameworks there is a need for non blocking API’s. Meet Reactive streams, like Spring Webflux, to super charge your API.
In this session I will tell about and show you Reactive API’s and more
9. Non-Blocking API calls
• (Almost) no limited requests
• Can process multiple requests
• Not knowing when response are returned
• Modern javascript frameworks rely on. (Angular, React, VueJS)
11. Reactive manifesto
• Responsive: a reactive system needs to handle requests in a
reasonable time
• Resilient: a reactive system must stay responsive in the face of
failures
• Elastic: a reactive system must stay responsive under various
loads
• Message driven: components from reactive systems interacts
using asynchronous message passing
16. Spring boot
• Open Source, coordinated by Pivotal
• Java based applications
• Auto configure as much as possible
• Built in metrics and health checks
• Very good documentation
17. Spring boot - component scan
• @Service, @Controller, @Repository and more @Components will be
scanned
• @Autowired will glue everything together
18. Spring boot - runs everywhere
• Embedded Tomcat makes it just run
• Runs on Docker
• Runs on Cloud Foundry, like IBM and PCF
• Tomcat can excluded, then it runs on Websphere, Tomcat or WildFly
• Even on Domino, http://hasselba.ch/blog/?p=2589
20. Spring Webflux
• Part of the Spring Framework
• Available since Spring 5.0
• Uses Netty as webserver instead of Tomcat
• Uses the Reactor project under the hood
21. Spring Webflux - important objects
• Mono, returns 0 or 1 object
• Flux, returns 0 or N objects
• WebClient, reactive version of RestTemplate
26. Start your first reactive API
• Install Maven or Gradle
• Move to start.spring.io
• Fill in all the fields and select the dependencies
• Generate, download and open project in IDE
• Run ‘mvn clean install’ for all the dependencies
• Start coding
• Run application via ‘mvn spring-boot:run’
29. Application properties
• port: on which the service is available
• profiles: dev or prod
• can used in Java classes
• can also moved outside the application