Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Erwin de Gier Real-world reactive programming in Java
@erwindeg github.com/erwindeg edegier.nl
Java 8 Streams vs. RX Observables
Pull vs. Push
Finite vs. Infinite
Sync vs. Async
Observable map() subscribe()
Iterable
Java 8 Streams vs. RX Observables
map()1 2 3 A B C forEach()
1 A2 B3 C
Java vs. Reactive Streams
Java 8 Streams vs. Reactive Streams
//IllegalState Exception
Reactive API
File IOHTTP
REST
Event bus
Persistence
Reactive Stack
Reactive Frameworks
VS.
Let
Reactive Overview
Framework
API
Event Model Annotations
Project Reactor
We are Blox
• Crypto positions
• Closed system
• Buy Crypto
• Sell Crypto
• Accounts
Architecture
Quote
Order
Market Exchange
RESTAPI
Command
Event
Query
RESTQuery
Quote Engine
REST
REST
Spring 5 Webflux
• Testing
• Spring Security
• Spring Cloud Hystrix
• Axon API’s: toFuture & fromFuture
WebFlux Testing
• @WebFluxTest(controllers = …)
• WebTestClient for WebFlux controller tests
• @MockBean for injected services
Spring Security
• Spring Security OAuth not working (legacy)
• Spring Security 5
•Misses OAuth Resource / Authorization server
Spring Security
SpringWeb
ZuulProxy
SpringWebFlux
RESTAPI
Auth Header
Response
Spring Security
• @EnableWebFluxSecurity
• Implement AuthenticationWebFilter
• Use http.addFilterAt(filter,order)
Spring Cloud Hystrix
• Cannot use the @HystrixCommand
• Use HystrixObservableCommand
• RxJava Observable vs Flux
Reactive Streams
Conclusion: state of reactive Java
• Libraries for reactive programming: Rx / Reactor
• Frameworks for async processes: Spring / Vert.x
• Expect to DIY
• Workarounds
e