SlideShare a Scribd company logo
1 of 26
Reactor
Foundational framework for Reactive, Fast
Data applications on the JVM
Jon Brisbin
Reactor Project Lead

© Copyright 2013 Pivotal. All rights reserved.

1
What is Reactor?
Reactor is a foundational library.

Plays in grey area between user-level and lower-level
abstractions.
Components and application cores can be built on
Reactor.
Drivers, servers, data integration libraries, domain
integration libraries, evented architectures.

© Copyright 2013 Pivotal. All rights reserved.

2
What is Reactor?
Reactor is a distillation of other libraries and bestpractices.
Elements of other patterns and libraries surface throughout
Reactor's abstractions.

© Copyright 2013 Pivotal. All rights reserved.

3
What is Reactor?

© Copyright 2013 Pivotal. All rights reserved.

4
What is Reactor?

© Copyright 2013 Pivotal. All rights reserved.

5
What is Reactive?
“Reactive programming can be seen as a natural
extension of higher-order functional programming to
concurrent systems that deal with distributed state by
coordinating and orchestrating asynchronous data
streams exchanged by actors.”
https://www.coursera.org/course/reactive

© Copyright 2013 Pivotal. All rights reserved.

6
What is Reactive?
Reactive Extensions in .NET
– http://rx.codeplex.com/

Netflix RxJava
– https://github.com/Netflix/RxJava

Observer pattern
– http://en.wikipedia.org/wiki/Observer_pattern

© Copyright 2013 Pivotal. All rights reserved.

7
How is Reactor reactive?
Reactor applications route events based on a Selector
– Like a routing topic, but can be any object
– $(“string”)
– $(anonymousObject)

RegexSelector: R(“topic.(.+)”)
UriTemplateSelector: U(“/{path}/{segment}**”)
ClassSelector: T(Throwable.class)
JsonPathSelector: J(“$.”)

© Copyright 2013 Pivotal. All rights reserved.

8
What does the code look like?

© Copyright 2013 Pivotal. All rights reserved.

9
What does the code look like?

© Copyright 2013 Pivotal. All rights reserved.

10
What does the code look like?

© Copyright 2013 Pivotal. All rights reserved.

11
What is Fast Data (and #uberfastdata)?
High throughput: millions per second.
– Selector-based dispatch: 10-15MM/sec
– RingBuffer Processor: 100MM/sec

Low latency: microseconds per request.
– DO. NOT. BLOCK!

High volume: billions per minute/hour/day.
– High sustained throughput

© Copyright 2013 Pivotal. All rights reserved.

12
Reactor - Dispatchers
Dispatchers manage task execution

ThreadPoolExecutorDispatcher
– Backed by standard ThreadPoolExecutor

BlockingQueueDispatcher
– Event Loop style

RingBufferDispatcher
– LMAX Disruptor RingBuffer

SynchronousDispatcher

© Copyright 2013 Pivotal. All rights reserved.

13
Reactor - Selectors
Can be created from any object using $(obj).
– Or use the long form: Selectors.object(obj)

Can extract data from the matched key.
– U(“/{path}/{segment}”) results in headers “path” and “segment”

Predicate<T> Selectors can match on domain-specific criteria
–
–
–
–
–

Header values
Object values
Time/Date
Moon Phase
Position of the ISS

© Copyright 2013 Pivotal. All rights reserved.

14
Reactor - Streams
Streams allow for composition of functions on data

Callback++
Netflix RxJava Observable, JDK 8 Stream
stream.map(String::toUpperCase)
.filter(new Predicate<String>() {
public boolean test(String s) { … }
})
.consume(s → log.info(“consumed string {}”, s));

© Copyright 2013 Pivotal. All rights reserved.

15
Reactor - Promises
Promise<String> p;
String s = p
.onSuccess(s → log.info(“consumed string {}”, s))
.onFailure(t → log.error(t.getMessage(), t))
.onComplete(t → log.info(“complete”))
.await(5, SECONDS);

p.map(String::toUpperCase).consume(
s → log.info(“UC: {}”, s)
);

© Copyright 2013 Pivotal. All rights reserved.

16
Reactor - Processor
Processor<Buffer> proc;
Operation<Buffer> op = proc.prepare();
op.get().append(data).flip();
op.commit();
proc.batch(512, buff → buff.append(data).flip());

© Copyright 2013 Pivotal. All rights reserved.

17
Reactor - Spring
@Configuration
@EnableReactor
public class ReactorConfiguration {
@Bean
public Reactor input(Environment env) {
return Reactors.reactor(env);
}
@Bean
public Reactor output(Environment env) {
return Reactors.reactor(env);
}
© Copyright 2013 Pivotal. All rights reserved.

18
Reactor - Spring
@Component
public class SimpleHandler {
@Autowired
private Reactor reactor;
@Selector(“test.topic”)
public void onTestTopic(String s) {
// Handle data
}
}

© Copyright 2013 Pivotal. All rights reserved.

19
Reactor - Demo

© Copyright 2013 Pivotal. All rights reserved.

20
Reactor – Random Awesomeness
TCP Client/Server, with a Netty 4 implementation

Buffer tools
Sequencer support, for event ordering
Work Queue support, with OOTB Java Chronicle implementation
Logback Appender
Dynamic Interface-based event proxies

© Copyright 2013 Pivotal. All rights reserved.

21
Reactor – 3rd Party Support
Meltdown: A Clojure binding by @michaelklishin & @ifesdjeen
– https://github.com/clojurewerkz/meltdown

Couchbase: v2 Java SDK platform

© Copyright 2013 Pivotal. All rights reserved.

22
Reactor – Spring Framework 4.0
STOMP
– Reactor TCP handles STOMP broker relay

ReactorSubscribableChannel
– SubscribableChannel implementation

© Copyright 2013 Pivotal. All rights reserved.

23
Reactor – Spring Integration
ReactorProcessorMessageDispatcher
– Pluggable into any MessageChannel that takes a MessageDispatcher

XML Namespace support
– <int-reactor:syslog-inbound-channel-adapter id="syslog" port="${port:5140}"
channel="output" auto-startup="false"/>

More Integration planned in near future

© Copyright 2013 Pivotal. All rights reserved.

24
Reactor – Spring XD
TCP + Netty: Supports all standard Netty Codecs
– HTTP, FTP, SMTP, WebSocket, protobuf, etc…

Syslog: Standard syslog ingest using Reactor TCP
– reactor-syslog: ~700k/sec
– syslog-tcp: ~30k/sec

MessageBus: Using Selectors like topics and queues
– Based on RedisMessageBus

© Copyright 2013 Pivotal. All rights reserved.

25
BUILT FOR THE SPEED OF BUSINESS

More Related Content

What's hot

Winning the Lottery with Spring: A Microservices Case Study for the Dutch Lot...
Winning the Lottery with Spring: A Microservices Case Study for the Dutch Lot...Winning the Lottery with Spring: A Microservices Case Study for the Dutch Lot...
Winning the Lottery with Spring: A Microservices Case Study for the Dutch Lot...VMware Tanzu
 
Refactor your Java EE application using Microservices and Containers - Arun G...
Refactor your Java EE application using Microservices and Containers - Arun G...Refactor your Java EE application using Microservices and Containers - Arun G...
Refactor your Java EE application using Microservices and Containers - Arun G...Codemotion
 
How easy (or hard) it is to monitor your graph ql service performance
How easy (or hard) it is to monitor your graph ql service performanceHow easy (or hard) it is to monitor your graph ql service performance
How easy (or hard) it is to monitor your graph ql service performanceLuca Mattia Ferrari
 
Managing microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - MeetupManaging microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - MeetupJosé Román Martín Gil
 
Simplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring CloudSimplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring CloudRamnivas Laddad
 
Cloud-Native Streaming and Event-Driven Microservices
Cloud-Native Streaming and Event-Driven MicroservicesCloud-Native Streaming and Event-Driven Microservices
Cloud-Native Streaming and Event-Driven MicroservicesVMware Tanzu
 
Expect the unexpected: Anticipate and prepare for failures in microservices b...
Expect the unexpected: Anticipate and prepare for failures in microservices b...Expect the unexpected: Anticipate and prepare for failures in microservices b...
Expect the unexpected: Anticipate and prepare for failures in microservices b...Bhakti Mehta
 
Tales From The Ship: Navigating the OpenStack Community Seas
Tales From The Ship: Navigating the OpenStack Community SeasTales From The Ship: Navigating the OpenStack Community Seas
Tales From The Ship: Navigating the OpenStack Community SeasMirantis
 
Micronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureMicronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureZachary Klein
 
Distributed Tracing with Jaeger
Distributed Tracing with JaegerDistributed Tracing with Jaeger
Distributed Tracing with JaegerInho Kang
 
Adding Security to your SLO-based Release Validation with Keptn
Adding Security to your SLO-based Release Validation with KeptnAdding Security to your SLO-based Release Validation with Keptn
Adding Security to your SLO-based Release Validation with KeptnAndreas Grabner
 
Kubernetes and lastminute.com: our course towards better scalability and proc...
Kubernetes and lastminute.com: our course towards better scalability and proc...Kubernetes and lastminute.com: our course towards better scalability and proc...
Kubernetes and lastminute.com: our course towards better scalability and proc...Michele Orsi
 
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...VMware Tanzu
 
Software Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight ProjectSoftware Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight ProjectGreat Wide Open
 
CQRS and Event Sourcing
CQRS and Event Sourcing CQRS and Event Sourcing
CQRS and Event Sourcing Inho Kang
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoringOracle Korea
 

What's hot (20)

Winning the Lottery with Spring: A Microservices Case Study for the Dutch Lot...
Winning the Lottery with Spring: A Microservices Case Study for the Dutch Lot...Winning the Lottery with Spring: A Microservices Case Study for the Dutch Lot...
Winning the Lottery with Spring: A Microservices Case Study for the Dutch Lot...
 
Refactor your Java EE application using Microservices and Containers - Arun G...
Refactor your Java EE application using Microservices and Containers - Arun G...Refactor your Java EE application using Microservices and Containers - Arun G...
Refactor your Java EE application using Microservices and Containers - Arun G...
 
How easy (or hard) it is to monitor your graph ql service performance
How easy (or hard) it is to monitor your graph ql service performanceHow easy (or hard) it is to monitor your graph ql service performance
How easy (or hard) it is to monitor your graph ql service performance
 
Managing microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - MeetupManaging microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - Meetup
 
Simplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring CloudSimplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring Cloud
 
OpenDaylight nluug_november
OpenDaylight nluug_novemberOpenDaylight nluug_november
OpenDaylight nluug_november
 
Cloud-Native Streaming and Event-Driven Microservices
Cloud-Native Streaming and Event-Driven MicroservicesCloud-Native Streaming and Event-Driven Microservices
Cloud-Native Streaming and Event-Driven Microservices
 
Expect the unexpected: Anticipate and prepare for failures in microservices b...
Expect the unexpected: Anticipate and prepare for failures in microservices b...Expect the unexpected: Anticipate and prepare for failures in microservices b...
Expect the unexpected: Anticipate and prepare for failures in microservices b...
 
Tales From The Ship: Navigating the OpenStack Community Seas
Tales From The Ship: Navigating the OpenStack Community SeasTales From The Ship: Navigating the OpenStack Community Seas
Tales From The Ship: Navigating the OpenStack Community Seas
 
Micronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureMicronaut: Changing the Micro Future
Micronaut: Changing the Micro Future
 
Distributed Tracing with Jaeger
Distributed Tracing with JaegerDistributed Tracing with Jaeger
Distributed Tracing with Jaeger
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Adding Security to your SLO-based Release Validation with Keptn
Adding Security to your SLO-based Release Validation with KeptnAdding Security to your SLO-based Release Validation with Keptn
Adding Security to your SLO-based Release Validation with Keptn
 
Kubernetes and lastminute.com: our course towards better scalability and proc...
Kubernetes and lastminute.com: our course towards better scalability and proc...Kubernetes and lastminute.com: our course towards better scalability and proc...
Kubernetes and lastminute.com: our course towards better scalability and proc...
 
Serverless Spring
Serverless SpringServerless Spring
Serverless Spring
 
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
 
Software Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight ProjectSoftware Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight Project
 
JEE on DC/OS
JEE on DC/OSJEE on DC/OS
JEE on DC/OS
 
CQRS and Event Sourcing
CQRS and Event Sourcing CQRS and Event Sourcing
CQRS and Event Sourcing
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoring
 

Viewers also liked

Reactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesReactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesStéphane Maldini
 
Brown Bag : CDAP (f.k.a Reactor) Streams Deep DiveStream on file brown bag
Brown Bag : CDAP (f.k.a Reactor) Streams Deep DiveStream on file brown bagBrown Bag : CDAP (f.k.a Reactor) Streams Deep DiveStream on file brown bag
Brown Bag : CDAP (f.k.a Reactor) Streams Deep DiveStream on file brown bagCask Data
 
Introduction and Molar Balances - Reactor Engineering Course Block 1
Introduction and Molar Balances - Reactor Engineering Course Block 1Introduction and Molar Balances - Reactor Engineering Course Block 1
Introduction and Molar Balances - Reactor Engineering Course Block 1Chemical Engineering Guy
 
Going Reactive with Spring 5 & Project Reactor
Going Reactive with Spring 5 & Project ReactorGoing Reactive with Spring 5 & Project Reactor
Going Reactive with Spring 5 & Project ReactorMark Heckler
 
Why Domain-Driven Design and Reactive Programming?
Why Domain-Driven Design and Reactive Programming?Why Domain-Driven Design and Reactive Programming?
Why Domain-Driven Design and Reactive Programming?VMware Tanzu
 
Reactive Programming in Spring 5
Reactive Programming in Spring 5Reactive Programming in Spring 5
Reactive Programming in Spring 5poutsma
 
The Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationThe Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationKasun Indrasiri
 
Node.js and The Internet of Things
Node.js and The Internet of ThingsNode.js and The Internet of Things
Node.js and The Internet of ThingsLosant
 

Viewers also liked (8)

Reactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesReactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServices
 
Brown Bag : CDAP (f.k.a Reactor) Streams Deep DiveStream on file brown bag
Brown Bag : CDAP (f.k.a Reactor) Streams Deep DiveStream on file brown bagBrown Bag : CDAP (f.k.a Reactor) Streams Deep DiveStream on file brown bag
Brown Bag : CDAP (f.k.a Reactor) Streams Deep DiveStream on file brown bag
 
Introduction and Molar Balances - Reactor Engineering Course Block 1
Introduction and Molar Balances - Reactor Engineering Course Block 1Introduction and Molar Balances - Reactor Engineering Course Block 1
Introduction and Molar Balances - Reactor Engineering Course Block 1
 
Going Reactive with Spring 5 & Project Reactor
Going Reactive with Spring 5 & Project ReactorGoing Reactive with Spring 5 & Project Reactor
Going Reactive with Spring 5 & Project Reactor
 
Why Domain-Driven Design and Reactive Programming?
Why Domain-Driven Design and Reactive Programming?Why Domain-Driven Design and Reactive Programming?
Why Domain-Driven Design and Reactive Programming?
 
Reactive Programming in Spring 5
Reactive Programming in Spring 5Reactive Programming in Spring 5
Reactive Programming in Spring 5
 
The Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationThe Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital Transformation
 
Node.js and The Internet of Things
Node.js and The Internet of ThingsNode.js and The Internet of Things
Node.js and The Internet of Things
 

Similar to Intro to Reactor

IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016Trayan Iliev
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programmingAraf Karsh Hamid
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingAraf Karsh Hamid
 
Microservices with Spring 5 Webflux - jProfessionals
Microservices  with Spring 5 Webflux - jProfessionalsMicroservices  with Spring 5 Webflux - jProfessionals
Microservices with Spring 5 Webflux - jProfessionalsTrayan Iliev
 
Reactive robotics io_t_2017
Reactive robotics io_t_2017Reactive robotics io_t_2017
Reactive robotics io_t_2017Trayan Iliev
 
Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Trayan Iliev
 
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorReactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorVMware Tanzu
 
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...Juarez Junior
 
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016Trayan Iliev
 
Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Trayan Iliev
 
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusMicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusEmily Jiang
 
Reactive programming
Reactive programmingReactive programming
Reactive programmingSUDIP GHOSH
 
Reactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring BootReactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring BootVMware Tanzu
 
OpenStack Neutron Havana Overview - Oct 2013
OpenStack Neutron Havana Overview - Oct 2013OpenStack Neutron Havana Overview - Oct 2013
OpenStack Neutron Havana Overview - Oct 2013Edgar Magana
 
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmGenomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmDmitri Zimine
 
Reactive java programming for the impatient
Reactive java programming for the impatientReactive java programming for the impatient
Reactive java programming for the impatientGrant Steinfeld
 
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-orsCharacterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-orsLee Calcote
 
Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Trayan Iliev
 
Stream Processing with CompletableFuture and Flow in Java 9
Stream Processing with CompletableFuture and Flow in Java 9Stream Processing with CompletableFuture and Flow in Java 9
Stream Processing with CompletableFuture and Flow in Java 9Trayan Iliev
 

Similar to Intro to Reactor (20)

IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programming
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive Programming
 
Microservices with Spring 5 Webflux - jProfessionals
Microservices  with Spring 5 Webflux - jProfessionalsMicroservices  with Spring 5 Webflux - jProfessionals
Microservices with Spring 5 Webflux - jProfessionals
 
Reactors.io
Reactors.ioReactors.io
Reactors.io
 
Reactive robotics io_t_2017
Reactive robotics io_t_2017Reactive robotics io_t_2017
Reactive robotics io_t_2017
 
Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018
 
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorReactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
 
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
 
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
 
Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016
 
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusMicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
 
Reactive programming
Reactive programmingReactive programming
Reactive programming
 
Reactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring BootReactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring Boot
 
OpenStack Neutron Havana Overview - Oct 2013
OpenStack Neutron Havana Overview - Oct 2013OpenStack Neutron Havana Overview - Oct 2013
OpenStack Neutron Havana Overview - Oct 2013
 
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmGenomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
 
Reactive java programming for the impatient
Reactive java programming for the impatientReactive java programming for the impatient
Reactive java programming for the impatient
 
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-orsCharacterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
 
Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux
 
Stream Processing with CompletableFuture and Flow in Java 9
Stream Processing with CompletableFuture and Flow in Java 9Stream Processing with CompletableFuture and Flow in Java 9
Stream Processing with CompletableFuture and Flow in Java 9
 

Recently uploaded

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Recently uploaded (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

Intro to Reactor

  • 1. Reactor Foundational framework for Reactive, Fast Data applications on the JVM Jon Brisbin Reactor Project Lead © Copyright 2013 Pivotal. All rights reserved. 1
  • 2. What is Reactor? Reactor is a foundational library. Plays in grey area between user-level and lower-level abstractions. Components and application cores can be built on Reactor. Drivers, servers, data integration libraries, domain integration libraries, evented architectures. © Copyright 2013 Pivotal. All rights reserved. 2
  • 3. What is Reactor? Reactor is a distillation of other libraries and bestpractices. Elements of other patterns and libraries surface throughout Reactor's abstractions. © Copyright 2013 Pivotal. All rights reserved. 3
  • 4. What is Reactor? © Copyright 2013 Pivotal. All rights reserved. 4
  • 5. What is Reactor? © Copyright 2013 Pivotal. All rights reserved. 5
  • 6. What is Reactive? “Reactive programming can be seen as a natural extension of higher-order functional programming to concurrent systems that deal with distributed state by coordinating and orchestrating asynchronous data streams exchanged by actors.” https://www.coursera.org/course/reactive © Copyright 2013 Pivotal. All rights reserved. 6
  • 7. What is Reactive? Reactive Extensions in .NET – http://rx.codeplex.com/ Netflix RxJava – https://github.com/Netflix/RxJava Observer pattern – http://en.wikipedia.org/wiki/Observer_pattern © Copyright 2013 Pivotal. All rights reserved. 7
  • 8. How is Reactor reactive? Reactor applications route events based on a Selector – Like a routing topic, but can be any object – $(“string”) – $(anonymousObject) RegexSelector: R(“topic.(.+)”) UriTemplateSelector: U(“/{path}/{segment}**”) ClassSelector: T(Throwable.class) JsonPathSelector: J(“$.”) © Copyright 2013 Pivotal. All rights reserved. 8
  • 9. What does the code look like? © Copyright 2013 Pivotal. All rights reserved. 9
  • 10. What does the code look like? © Copyright 2013 Pivotal. All rights reserved. 10
  • 11. What does the code look like? © Copyright 2013 Pivotal. All rights reserved. 11
  • 12. What is Fast Data (and #uberfastdata)? High throughput: millions per second. – Selector-based dispatch: 10-15MM/sec – RingBuffer Processor: 100MM/sec Low latency: microseconds per request. – DO. NOT. BLOCK! High volume: billions per minute/hour/day. – High sustained throughput © Copyright 2013 Pivotal. All rights reserved. 12
  • 13. Reactor - Dispatchers Dispatchers manage task execution ThreadPoolExecutorDispatcher – Backed by standard ThreadPoolExecutor BlockingQueueDispatcher – Event Loop style RingBufferDispatcher – LMAX Disruptor RingBuffer SynchronousDispatcher © Copyright 2013 Pivotal. All rights reserved. 13
  • 14. Reactor - Selectors Can be created from any object using $(obj). – Or use the long form: Selectors.object(obj) Can extract data from the matched key. – U(“/{path}/{segment}”) results in headers “path” and “segment” Predicate<T> Selectors can match on domain-specific criteria – – – – – Header values Object values Time/Date Moon Phase Position of the ISS © Copyright 2013 Pivotal. All rights reserved. 14
  • 15. Reactor - Streams Streams allow for composition of functions on data Callback++ Netflix RxJava Observable, JDK 8 Stream stream.map(String::toUpperCase) .filter(new Predicate<String>() { public boolean test(String s) { … } }) .consume(s → log.info(“consumed string {}”, s)); © Copyright 2013 Pivotal. All rights reserved. 15
  • 16. Reactor - Promises Promise<String> p; String s = p .onSuccess(s → log.info(“consumed string {}”, s)) .onFailure(t → log.error(t.getMessage(), t)) .onComplete(t → log.info(“complete”)) .await(5, SECONDS); p.map(String::toUpperCase).consume( s → log.info(“UC: {}”, s) ); © Copyright 2013 Pivotal. All rights reserved. 16
  • 17. Reactor - Processor Processor<Buffer> proc; Operation<Buffer> op = proc.prepare(); op.get().append(data).flip(); op.commit(); proc.batch(512, buff → buff.append(data).flip()); © Copyright 2013 Pivotal. All rights reserved. 17
  • 18. Reactor - Spring @Configuration @EnableReactor public class ReactorConfiguration { @Bean public Reactor input(Environment env) { return Reactors.reactor(env); } @Bean public Reactor output(Environment env) { return Reactors.reactor(env); } © Copyright 2013 Pivotal. All rights reserved. 18
  • 19. Reactor - Spring @Component public class SimpleHandler { @Autowired private Reactor reactor; @Selector(“test.topic”) public void onTestTopic(String s) { // Handle data } } © Copyright 2013 Pivotal. All rights reserved. 19
  • 20. Reactor - Demo © Copyright 2013 Pivotal. All rights reserved. 20
  • 21. Reactor – Random Awesomeness TCP Client/Server, with a Netty 4 implementation Buffer tools Sequencer support, for event ordering Work Queue support, with OOTB Java Chronicle implementation Logback Appender Dynamic Interface-based event proxies © Copyright 2013 Pivotal. All rights reserved. 21
  • 22. Reactor – 3rd Party Support Meltdown: A Clojure binding by @michaelklishin & @ifesdjeen – https://github.com/clojurewerkz/meltdown Couchbase: v2 Java SDK platform © Copyright 2013 Pivotal. All rights reserved. 22
  • 23. Reactor – Spring Framework 4.0 STOMP – Reactor TCP handles STOMP broker relay ReactorSubscribableChannel – SubscribableChannel implementation © Copyright 2013 Pivotal. All rights reserved. 23
  • 24. Reactor – Spring Integration ReactorProcessorMessageDispatcher – Pluggable into any MessageChannel that takes a MessageDispatcher XML Namespace support – <int-reactor:syslog-inbound-channel-adapter id="syslog" port="${port:5140}" channel="output" auto-startup="false"/> More Integration planned in near future © Copyright 2013 Pivotal. All rights reserved. 24
  • 25. Reactor – Spring XD TCP + Netty: Supports all standard Netty Codecs – HTTP, FTP, SMTP, WebSocket, protobuf, etc… Syslog: Standard syslog ingest using Reactor TCP – reactor-syslog: ~700k/sec – syslog-tcp: ~30k/sec MessageBus: Using Selectors like topics and queues – Based on RedisMessageBus © Copyright 2013 Pivotal. All rights reserved. 25
  • 26. BUILT FOR THE SPEED OF BUSINESS