https://github.com/orlandovald/reactive-tweets
Reactive Tweets
Orlando Valdez / @orlandovald_
Charlotte JUG / @cltjug / cltjug.org
Reactive programming is an asynchronous programming
paradigm concerned with data streams and the
propagation of change.
https://en.wikipedia.org/wiki/Reactive_programming
Reactive Programming
https://www.reactive-streams.org/
Reactive Streams
Reactive Streams is an initiative to provide a
standard for asynchronous stream processing
with non-blocking back pressure
What is it trying to solve?
Application
GET /api/tweets
ServletContainer
BlockingI/O
GET /api/tweets
GET /api/tweets
Non-blocking event loop
GET /api/tweets
Response
https://github.com/reactive-streams/reactive-streams-jvm/blob/v1.0.3/README.md#specification
Reactive Streams - Spec
public interface Subscription {
public void request(long n);
public void cancel();
}
public interface Processor<T, R> extends
Subscriber<T>, Publisher<R> { }
public interface Subscriber<T> {
public void onSubscribe(Subscription s);
public void onNext(T t);
public void onError(Throwable t);
public void onComplete();
}
public interface Publisher<T> {
public void subscribe(Subscriber<? super T> s);
}
Reactive Streams - Implementations
https://projectreactor.io/
Project Reactor
• Reactor is a fully non-blocking foundation with
efficient demand management

• Spring 5 dependency

• 2 Reactive Composable types

‣ Mono<T> for 0..1 elements

‣ Flux<T> for 0..N elements
Let’s build a reactive system
stream.twitter.com
Server Sent

Events (SSE)
Spring WebfluxSpring Data
Orlando Valdez / @orlandovald_
https://github.com/orlandovald/reactive-tweets
Reactive Tweets
Charlotte JUG / @cltjug / cltjug.org
Please rate this presentation on the app!
Thanks for coming!

Reactive Tweets