Top Banner
An introduction to reactive applications, Reactive Streams, and options for the JVM Steve Pember CTO, ThirdChannel Software Architecture Con, 2016 THIRDCHANNEL @svpember
158

An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Jan 21, 2017

Download

Software

Steve Pember
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

An introduction to reactive applications, Reactive Streams, and

options for the JVMSteve Pember

CTO, ThirdChannel

Software Architecture Con, 2016

THIRDCHANNEL @svpember

Page 2: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Agenda• The Problem

• To Be Reactive

• What are Reactive Streams?

• Rx in Depth

• An Overview of JVM Options

• Demo Time!

Page 3: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

The Problem: The Need to go Reactive

Page 4: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Really, it’s Two problems

Page 5: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

1) Performance Demands Are Always Increasing

Page 6: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 7: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

We Use Technology from the Beginning of Web Development

Page 8: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 9: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Things Slow Down

Page 10: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Users get angry quickly

Page 11: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

–Johnny Appleseed

“Type a quote here.”

Page 12: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Let’s Keep Our Users Happy And Engaged

Page 13: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

2) The Rise of Microservices

Page 14: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Multiple Integration Points

Page 15: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

It’s Not Only Users That Use Up Resources

Page 16: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 17: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

So… what to do?

Page 18: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Embrace Reactive Applications

Page 19: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 20: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 21: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Reactive Applications• Responsive

Page 22: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 23: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Reactive Applications• Responsive

• Resilient

Page 24: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 25: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Embrace Failure

Page 26: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 27: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Independent Things Fail Independently

Page 28: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Reactive Applications• Responsive

• Resilient

• Elastic (Scalable)

Page 29: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 30: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Reactive Applications• Responsive

• Resilient

• Elastic (Scalable)

• Asynchronous / Message Driven

Page 31: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Free up resources with Async Operations & Non-Blocking I/O

Page 32: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Now do all of this at every level of your app…

Page 33: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

All the Way Down

Page 34: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 35: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 36: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

• User Interface: What the user interacts with (JS, iOS, Android)

• Inter-Service: Distributed application topology + service communication design (e.g. Kafka for async messaging)

• Intra-Service: The code! (well designed with bounded contexts)

• Framework: Structures your code + provides external communication, DI, etc

• Execution Environment: Broad area, but includes how your code is executed (e.g. in JVM: Tomcat, Jetty, Netty)

Page 37: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Mostly talk about this…

We’ll talk a little about this…

And a little more about this

Page 38: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

There’s not enough time!

Page 39: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Writing Reactive Code is the best method of introduction…

Page 40: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Async is Hard for Humans

Page 41: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

One Excellent Tool is (are?) Reactive Streams

Page 42: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

But Wait…

Page 43: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 44: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Agenda• The Problem

• What are Reactive Streams?

Page 45: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

“Reactive Streams”, “Reactive Extensions”, or “Rx”

Page 46: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Collections + Time

Page 47: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 48: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Single abstraction over data from many sources

Page 49: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 50: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Observer Pattern Push (not Pull) based Iterators

Page 51: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Stream-Based Functional Programming

Page 52: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Imperative vs Stream

Page 53: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Streams with Extensions for Reactive Programming

Page 54: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Rx makes Async behavior easy!

Page 55: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

(Reactive Pull) Backpressure

Page 56: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 57: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

What is Rx?• Collections + Time

• A Single Abstraction over data from different sources

• Observer Pattern with Push-based iterators

• Stream Based Functional Programming

• … with Extensions for Reactive Programming

• Async is easy

• Backpressure

Page 58: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Rx Simplifies Complex Work

Page 59: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

…Once you understand, of course…

Page 60: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Story Time!

Page 61: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Story Time

Page 62: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Story Time

Page 63: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Story Time

Page 64: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Story Time

2012 - MS Open Source’s RX!

Page 65: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Story Time

2012 - MS Open Source’s RX!

Page 66: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 67: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 68: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Agenda• The Problem

• What are Reactive Streams?

• Rx in depth

Page 69: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Key Terms:

Page 70: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

An Observable is like Promise ++

Page 71: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

(Observable: aka ‘Publisher’)

Page 72: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Observables are most powerful when wrapping external input

Page 73: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

An Observable pushes items to Subscribers

Page 74: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Subscribers receive and operate on emitted data

Page 75: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Observables and Subscribers operate on a Scheduler

Page 76: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

The following examples use rxJava 1.x

Page 77: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Also, try out rxGroovy

Page 78: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Groovy• Dynamic Language for the JVM

• Less Verbose (Reduce Java Boilerplate)

• Ruby/Python - esque Collections

• Run Time Meta Programming

• Optionally Typed

• AST Transformations

• Powerful Annotations

• Multi - Inheritance via Traits and @DelegatesTo

Page 79: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 80: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 81: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Basic Usage

Page 82: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 83: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 84: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Thankfully, there are shortcuts

Page 85: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 86: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 87: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Streams are Composable

Page 88: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 89: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

You can get much power from 5 functions• filter

• map

• reduce

• groupBy

• flatMap

Page 90: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 91: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 92: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 93: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 94: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

First Mental Leap: An Observable of Observables

Page 95: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

–Johnny Appleseed

“Type a quote here.”

Page 96: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 97: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Let’s get a little crazy

Page 98: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 99: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Hot vs Cold

Page 100: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Cold Observable: finite data, on demand Hot Observable: infinite data, as it’s ready

Page 101: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Cold Observable: only starts emitting data on .subscribe () Hot Observable: emits data whenever it’s ready

Page 102: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Asynchronous Streams

Page 103: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 104: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 105: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 106: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

BackPressure

Page 107: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 108: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Can only Mitigate Hot Streams• throttle

• sample

• window

• buffer

• drop

Page 109: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Stream Interaction

Page 110: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Don’t Unsubscribe from Observables

Programmatically complete them when another Observable fires

Page 111: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 112: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

AutoComplete Requirements• Wait 250 ms between keypresses before querying

• If no keys are pressed, no query

• Successful queries should render movies

• Any new queries should kill in-flight queries

Page 113: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 114: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Pretty Great, But what’s going on?

Page 115: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

keyPress stream creates a sub- stream which is reacting to subsequent data from the parent

Page 116: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 117: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Questions?

Page 118: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Ok, what about 2.0?

Page 119: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

API hasn’t changed much

Page 120: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 121: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

RxJava 2.0• Completely rebuilt for Reactive-Streams.org 1.0 spec

• Decreased resource usage

• No nulls allowed

• New Publisher types

Page 122: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Publishers• Observable - classic. In 2.0: no Backpressure

• Flowable - new to 2.0. Use this for Backpressure

• Single - only one item will be emitted or signal error

• Completable - only signal success or error

• Maybe - new to 2.0: one item emitted, signal success, or signal error (think, Promise)

Page 123: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Agenda• The Problem

• What are Reactive Streams?

• Rx In Depth

• An Overview of JVM options

Page 124: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Intra-Service Options

Page 125: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

RxJava, Obviously

Page 126: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 127: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 128: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

ReactiveX JVM Family• rxJava

• rxJavaFX

• rxGroovy

• rxClojure

• rxKotlin

• rxScala

• And many more (beyond JVM): https://github.com/ReactiveX

Page 129: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Akka & Akka Streams• Library

• Definition of Reactive System

• Created by LightBend

• Actor-Based Concurrency

• Implemented Streams on Top of Actor Model

Page 130: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 131: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 132: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 133: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

–Johnny Appleseed

“Type a quote here.”

Page 134: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

–Johnny Appleseed

“Type a quote here.”

Page 135: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

• Pivotal Project

• Library

• Reactive Streams

• Built on LMAX Ring Buffer / Disrupter

• Multiple libraries to extend Disruptor in multiple ways

Page 136: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 137: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 138: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 139: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 140: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Page 141: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Java 9 will have Flow

Page 142: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Framework Level

Page 143: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

• High Performance Web Framework

• Non-Opinionated

• Non-Blocking Network Stack

• Built on Reactive Streams, Netty, Java 8, Guice

• Deterministic Asynchronous Execution

Take a Look at Ratpack

Page 144: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

http://www.infoq.com/presentations/ratpack-2015

Page 145: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Includes rxRatpack module, but we’ll talk about that later

Page 146: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 147: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

… specifically, Spring 5

Page 148: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Spring Web Reactive vs Spring Web MVC

Page 149: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Spring 5• spring-web-reactive instead of spring-mvc

• Same @Controller programming model

• Different underlying API

• Based on Project Reactor

• Can run within Tomcat, Jetty, or Netty (e.g. can fallback to use servlets)

Page 150: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 151: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Play Framework• Part of the Lightbend family

• Built on Akka and Netty

• Async I/O

• Lightweight and stateless

• Encourages RESTful design

• Focus on JSON

Page 152: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)
Page 153: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Vert.X• Event-driven & Non blocking

• lightweight, non-opinionated, and modular

• integrates with rxJava

• support for additional languages (like JS and Ruby)

• Can be used as a library embedded in an existing app

Page 154: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Demo Time

Page 155: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

Any Questions?

Page 156: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Thank You!

@svpember [email protected]

THIRDCHANNEL @svpember

Page 157: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

THIRDCHANNEL @svpember

More Information• Reactive Groovy & Ratpack Demo: https://github.com/spember/reactive-movie-demo • Jafar Husain: RxJS: https://www.youtube.com/watch?v=XRYN2xt11Ek • Reactive Streams Spec: http://www.reactive-streams.org/ • Reactive Manifesto: http://www.reactivemanifesto.org/ • Akka: http://akka.io/ • rxJava / ReactiveX libraries: https://github.com/ReactiveX • Ratpack: http://ratpack.io/ • Reactor: https://github.com/reactor/reactor • The Introduction to Reactive Programming you’ve been missing: https://gist.github.com/staltz/868e7e9bc2a7b8c1f754 • Martin Fowler: Stream / Pipeline programming: http://martinfowler.com/articles/refactoring-pipelines.html • Or Just on Groovy (Groovy the Awesome Parts): http://www.slideshare.net/SpringCentral/groovy-the-awesome-parts • Ratpack Web Presentation: http://www.infoq.com/presentations/ratpack-2015 • Advanced RxJava Blog: http://akarnokd.blogspot.com/ • Martin Fowler LMAX breakdown: http://martinfowler.com/articles/lmax.html • Reactive Web Apps with Spring 5: https://www.youtube.com/watch?v=rdgJ8fOxJhc&feature=youtu.be

Page 158: An introduction to Reactive applications, Reactive Streams, and options for the JVM (SACon SF 2016)

Images• Empty Pool: http://www.wtok.com/home/headlines/Water-Problems-205987121.html

• Juggling: https://en.wikipedia.org/wiki/Juggling

• Directing Traffic: https://www.flickr.com/photos/tracilawson/3474012583L

• LMAX Disrupter: http://martinfowler.com/articles/lmax.html

• Mailman: thebrandtstandard.com/2013/02/09/u-s-post-office-to-end-saturday-letter-delivery-this-summer/

• Actors Diagram: https://blog.codecentric.de/en/2015/08/introduction-to-akka-actors/

• Cheetah: www.livescience.com/21944-usain-bolt-vs-cheetah-animal-olympics.html

• Dominoes: https://www.flickr.com/photos/louish/5611657857/sizes/l/in/photostream/

• Spartans: www.300themovie.com/

• Stampeding Buffalo: news.sd.gov/newsitem.aspx?id=15164

• Turtles (Cosmic): http://synchronicity313.deviantart.com/art/Turtles-All-The-Way-Down-68160813

• XkCD turtles: https://xkcd.com/1416/

• Simpsons “Old Coot”: http://simpsons.wikia.com/wiki/Category:Grandparents

• Meditation: http://i.huffpost.com/gen/1405484/images/o-MEDITATION-facebook.jpg

• Death Star Architectures: http://www.slideshare.net/adriancockcroft/monitorama-please-no-more