groovy options for reactive applications - greach 2015

69
THIRDCHANNEL Reactive Options for Groovy Steve Pember CTO, ThirdChannel @svpember Greach, 2015

Upload: steve-pember

Post on 20-Jul-2015

731 views

Category:

Software


0 download

TRANSCRIPT

THIRDCHANNEL

Reactive Options for Groovy

Steve Pember

CTO, ThirdChannel

@svpember

Greach, 2015

What is ‘Reactive’?

THIRDCHANNEL

Possible Reactive Definitions• Reactive Programming

Imperative: A = B+C at that moment in time

Reactive: A = B+C whenever B or C change

values

THIRDCHANNEL

Possible Reactive Definitions• Reactive Programming

• Reactive Systems

THIRDCHANNEL

Possible Reactive Definitions• Reactive Programming

• Reactive Systems

• Reactive Streams / Reactive Extensions (Rx)

All 3 Are Different, But Related

… Today is About Reactive Systems

and Rx

THIRDCHANNEL

Agenda• Reactive Systems

• Reactive Streams / Reactive Extensions

• Reactive Groovy

• Demos

THIRDCHANNEL

Agenda• Reactive Systems

The Need For Reactive

(The Reactive Manifesto)

–Johnny Appleseed

“Type a quote here.”

THIRDCHANNEL

–Johnny Appleseed

“Type a quote here.”

–Johnny Appleseed

“Type a quote here.”

Need to Handle As Many Users As

Possible

THIRDCHANNEL

Reactive Systems• The Need for Reactive

• 4 Reactive Principles

–Johnny Appleseed

“Type a quote here.”

THIRDCHANNEL

THIRDCHANNEL

Reactive Systems• The Need for Reactive

• 4 Reactive Principles

• Responsive

THIRDCHANNEL

THIRDCHANNEL

Reactive Systems• The Need for Reactive

• 4 Reactive Principles

• Responsive

• Resilient

–Johnny Appleseed

“Type a quote here.”

Embrace Failure

Independent Things Fail

Independently

THIRDCHANNEL

Reactive Systems• The Need for Reactive

• 4 Reactive Principles

• Responsive

• Resilient

• Elastic (Scalable)

THIRDCHANNEL

Reactive Systems• The Need for Reactive

• 4 Reactive Principles

• Responsive

• Resilient

• Elastic (Scalable)

• Asynchronous Message-Driven

Events

Actors

–Johnny Appleseed

“Type a quote here.”

–Johnny Appleseed

“Type a quote here.”

Never Block

THIRDCHANNEL

Agenda• Reactive Systems

• Reactive Streams / Reactive Extensions

THIRDCHANNEL

Reactive Streams / Extensions• Originally out of Microsoft

THIRDCHANNEL

Reactive Streams / Extensions• Originally out of Microsoft

• Brought to JVM

–Johnny Appleseed

“Type a quote here.”

THIRDCHANNEL

Reactive Streams / Extensions• Originally out of Microsoft

• Brought to JVM

• Designed to Handle Messages Asynchronously Across Boundaries

THIRDCHANNEL

Reactive Streams / Extensions• Originally out of Microsoft

• Brought to JVM

• Designed to Handle Messages Asynchronously Across Boundaries

• Composable

THIRDCHANNEL

Reactive Streams / Extensions• Originally out of Microsoft

• Brought to JVM

• Designed to Handle Messages Asynchronously Across Boundaries

• Composable

• Hot / Cold

THIRDCHANNEL

Reactive Streams / Extensions• Originally out of Microsoft

• Brought to JVM

• Designed to Handle Messages Asynchronously Across Boundaries

• Composable

• Hot / Cold

• Backpressure

THIRDCHANNEL

THIRDCHANNEL

Agenda• Reactive Systems

• Reactive Streams / Reactive Extensions

• Groovy Options

THIRDCHANNEL

A Few Groovy Options…• Akka

THIRDCHANNEL

A Few Groovy Options…• Akka

• Akka Streams

THIRDCHANNEL

Akka & Akka Streams• Definition of Reactive System

• Typesafe

• Actor-Based Concurrency

• Implemented Streams on Top of Actor Model

THIRDCHANNEL

A Few Groovy Options…• Akka

• Akka Streams

• RxJava / RxGroovy

THIRDCHANNEL

RxJava• Comes out of Netflix

• Part of reactivex.io

• Reactive Streams on the JVM

THIRDCHANNEL

THIRDCHANNEL

A Few Groovy Options…• Akka

• Akka Streams

• RxJava / RxGroovy

• Ratpack

THIRDCHANNEL

• HTTP application server

• Non-opinionated

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

• Fully embodies reactive

THIRDCHANNEL

A Few Groovy Options…• Akka

• Akka Streams

• RxJava / RxGroovy

• Ratpack

• Reactor

THIRDCHANNEL

• Reactive Streams

• Reactor Pattern

• Built on LMAX Ring Buffer / Disrupter

THIRDCHANNEL

VS

THIRDCHANNEL

THIRDCHANNEL

THIRDCHANNEL

What About Java 8 Streams?

THIRDCHANNEL

Java 8 Streams• Built into the language

• Meant for Finite Iterables

• Observables -> potentially infinite items, with back pressure

• “Pulling” vs “Pushing”

THIRDCHANNEL

Agenda• Reactive Systems

• Reactive Streams / Reactive Extensions

• Groovy Options

• Demos

Thank You!

Questions?@svpember

Image Credits• 1000ms Time To glass:

https://docs.google.com/presentation/d/1IRHyU7_crIiCjl0Gvue0WY3eY_eYvFQvSfwQouW9368/present?slide=id.g1e697bbb_0_7

• internet users in the world: http://www.internetlivestats.com/internet-users/

• internet users vs Facebook: https://medium.com/reactive-programming/what-is-reactive-programming-bc9fa7f4a7fc

• reactivex logo: https://www.stickermule.com/marketplace/2223-rx-reactive-extensions-logo-4

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

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

• 300 / Spartans: http://www.300themovie.com/

• latop punch: http://walls4joy.com/wallpaper/730566-angry-laptops-punch

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

• actor system: http://letitcrash.com/post/30585282971/discovering-message-flows-in-actor-systems-with

• slow down: http://forthefamily.org/reminder-slow/