SlideShare a Scribd company logo
REACTIVE EXTENSIONS
PULL…
• Most programming today is based on a “pull” model
• Ask a data source for an item, wait for the item to be returned,
  and then process it
• Our app is active the entire time
    • makes the request,
    • waits for the result (usually a blocking operation),
    • controls the speed at which we process the result
…VS PUSH
• The “push” model aims to make our applications less concerned
  with the data flow
• Our app asks a data source to notify us if it has data we can use
• The data source is responsible for the notification and sending
  of data
• Our app is free to continue on its way, and is simply notified if
  there’s new data
• AKA Observer Pattern
REACTIVE EXTENSIONS (RX)
• Some neat baked-in interfaces, extension methods, and static
  classes for implementing Pull-based (observable pattern)
  systems
• Originally announced on Nov 17, 2009
• Included in .NET v4.0
IOBSERVABLE<T>
• Interface representing a collection that you can “observe”
• IDisposable Subscribe(IObserver<Type> observer)
  only interface method
IOBSERVER<T>
• Interface representing something that can observe an
  observable
• void OnNext(T data) – called by observable when the
  next piece of data is ready
• void OnError(Exception ex) – called by
  observable when an error occurs
• void OnCompleted() – called by observable when the
  pull operation has completed
EXAMPLE!
• Twitter Firehose API Example
OBSERVABLE STATIC CLASS
• IObserable/IObserver are all well and good, but we really
  could’ve done that without Rx
• Observable/Observer provide static methods to create
  Observables/Observers without class definitions
• Provides a whole bunch of options
• Separate install (can be installed from NuGet)
OBSERVABLE
• Example Code!
SCHEDULER
• By default, Observable will automatically schedule itself on a
  certain thread, by default it uses TaskPool
• You can control this by passing in a scheduler
    • ImmediateScheduler, CurrentThreadScheduler,
      DispatcherScheduler, NewThreadScheduler,
      TaskPoolScheduler, ThreadPoolScheduler
    • Example Code!
RX AND LINQ
• Rx adds a few new LINQ extension methods, as well as uses
  the existing ones
• Example Code!
OBSERVABLE SUBJECT
• Subject is a proxy class you can use to wrap a non-pull system
  and create an observable
• Implements both IObservable<T> and IObserver<T>
• Example Code!
IQBSERVABLE
• Combines LINQ’s Queryable and Rx’s Observable functionality
• Queryable – allows you to create a query client side using
  LINQ, and pass that query to a data source
  (server, database, web service, etc)
• Observable – instead of blocking until the data comes back, will
  just let you know when it gets the data

More Related Content

PPTX
Training – Going Async
PPTX
Mini-Training: Let's have a rest
PPTX
Mini training - Reactive Extensions (Rx)
PPTX
Training - What is Performance ?
PPTX
Search and analyze your data with elasticsearch
PPTX
Dev-Friendly Ops
PDF
Reactive java - Reactive Programming + RxJava
PDF
EUC2015 - Load testing XMPP servers with Plain Old Erlang
Training – Going Async
Mini-Training: Let's have a rest
Mini training - Reactive Extensions (Rx)
Training - What is Performance ?
Search and analyze your data with elasticsearch
Dev-Friendly Ops
Reactive java - Reactive Programming + RxJava
EUC2015 - Load testing XMPP servers with Plain Old Erlang

What's hot (20)

PPTX
Project Orleans - Actor Model framework
PPTX
A Brief Intro to Microsoft Orleans
PDF
Variables in Pharo5
PPTX
"Walk in a distributed systems park with Orleans" Евгений Бобров
PPTX
Massively Scaleable .NET Web Services with Project Orleans
PPTX
What’s expected in Spring 5
PPTX
Reactive Micro Services with Java seminar
PDF
What's new in Solr 5.0
PDF
Lecture: MetaLinks
PDF
OSMC 2021 | Monitoring Open Source Hardware
PPTX
Project Reactor By Example
PDF
Ease of use in Apache Solr
PDF
Introduction to Akka
PDF
Reflection in Pharo: Beyond Smalltak
PDF
Active Cloud DB at CloudComp '10
PDF
Lecture: Advanced Reflection. MetaLinks
PDF
Apache Solr 5.0 and beyond
PDF
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
PDF
Introduction to reactive programming
PDF
AppScale + Neptune @ HPCDB
Project Orleans - Actor Model framework
A Brief Intro to Microsoft Orleans
Variables in Pharo5
"Walk in a distributed systems park with Orleans" Евгений Бобров
Massively Scaleable .NET Web Services with Project Orleans
What’s expected in Spring 5
Reactive Micro Services with Java seminar
What's new in Solr 5.0
Lecture: MetaLinks
OSMC 2021 | Monitoring Open Source Hardware
Project Reactor By Example
Ease of use in Apache Solr
Introduction to Akka
Reflection in Pharo: Beyond Smalltak
Active Cloud DB at CloudComp '10
Lecture: Advanced Reflection. MetaLinks
Apache Solr 5.0 and beyond
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
Introduction to reactive programming
AppScale + Neptune @ HPCDB
Ad

Similar to Reactive Extensions (20)

PPTX
Rx- Reactive Extensions for .NET
PDF
Reactive Extensions
PDF
Unite 2017 - Reactive Programming - Pieter Nijs
PPTX
Quick look in Reactive Extensions
PPTX
Functional reactive programming
PPTX
Reactive Extensions for .NET
PDF
RxJava - introduction & design
PPTX
Reactive Extensions (Rx)
PDF
Streams, Streams Everywhere! An Introduction to Rx
PDF
RxJava pour Android : présentation lors du GDG Android Montréal
PPTX
Microservices Part 4: Functional Reactive Programming
PPTX
Reactive Extensions: classic Observer in .NET
PPTX
Rx 101 - Tamir Dresher - Copenhagen .NET User Group
PDF
Buy ebook Rx.NET in Action with Examples in C# 1st Edition Tamir Dresher chea...
PPTX
Building responsive application with Rx - confoo - tamir dresher
PPTX
Reactive programming
PPTX
Reactive Extensions
PDF
Reactive Xamarin. UA Mobile 2016.
PDF
A Quick Intro to ReactiveX
PPTX
Reactive Extensions, Rx
Rx- Reactive Extensions for .NET
Reactive Extensions
Unite 2017 - Reactive Programming - Pieter Nijs
Quick look in Reactive Extensions
Functional reactive programming
Reactive Extensions for .NET
RxJava - introduction & design
Reactive Extensions (Rx)
Streams, Streams Everywhere! An Introduction to Rx
RxJava pour Android : présentation lors du GDG Android Montréal
Microservices Part 4: Functional Reactive Programming
Reactive Extensions: classic Observer in .NET
Rx 101 - Tamir Dresher - Copenhagen .NET User Group
Buy ebook Rx.NET in Action with Examples in C# 1st Edition Tamir Dresher chea...
Building responsive application with Rx - confoo - tamir dresher
Reactive programming
Reactive Extensions
Reactive Xamarin. UA Mobile 2016.
A Quick Intro to ReactiveX
Reactive Extensions, Rx
Ad

More from RTigger (20)

PPTX
You Can't Buy Agile
PPTX
Caching up is hard to do: Improving your Web Services' Performance
PPTX
Ready, set, go! An introduction to the Go programming language
PPTX
Open source web services
PPTX
How to hire a hacker
PPTX
Windows 8 programming with html and java script
PPTX
Open regina
PPTX
Single page apps and the web of tomorrow
PPTX
Async in .NET
PPTX
Give your web apps some backbone
PPTX
Hackers, hackathons, and you
PPTX
AJAX, JSON, and Client-Side Templates
PPTX
JavaScript!
PPTX
Parallel Processing
PPTX
Node.js
PPTX
Sql vs NoSQL
PPTX
Git’in Jiggy With Git
PPTX
What The F#
PPTX
Web Services
PPTX
Total Engagement
You Can't Buy Agile
Caching up is hard to do: Improving your Web Services' Performance
Ready, set, go! An introduction to the Go programming language
Open source web services
How to hire a hacker
Windows 8 programming with html and java script
Open regina
Single page apps and the web of tomorrow
Async in .NET
Give your web apps some backbone
Hackers, hackathons, and you
AJAX, JSON, and Client-Side Templates
JavaScript!
Parallel Processing
Node.js
Sql vs NoSQL
Git’in Jiggy With Git
What The F#
Web Services
Total Engagement

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
KodekX | Application Modernization Development
PPT
Teaching material agriculture food technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Electronic commerce courselecture one. Pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
A Presentation on Artificial Intelligence
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
KodekX | Application Modernization Development
Teaching material agriculture food technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...
Electronic commerce courselecture one. Pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
Encapsulation_ Review paper, used for researhc scholars
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
A Presentation on Artificial Intelligence
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
NewMind AI Weekly Chronicles - August'25 Week I

Reactive Extensions

  • 2. PULL… • Most programming today is based on a “pull” model • Ask a data source for an item, wait for the item to be returned, and then process it • Our app is active the entire time • makes the request, • waits for the result (usually a blocking operation), • controls the speed at which we process the result
  • 3. …VS PUSH • The “push” model aims to make our applications less concerned with the data flow • Our app asks a data source to notify us if it has data we can use • The data source is responsible for the notification and sending of data • Our app is free to continue on its way, and is simply notified if there’s new data • AKA Observer Pattern
  • 4. REACTIVE EXTENSIONS (RX) • Some neat baked-in interfaces, extension methods, and static classes for implementing Pull-based (observable pattern) systems • Originally announced on Nov 17, 2009 • Included in .NET v4.0
  • 5. IOBSERVABLE<T> • Interface representing a collection that you can “observe” • IDisposable Subscribe(IObserver<Type> observer) only interface method
  • 6. IOBSERVER<T> • Interface representing something that can observe an observable • void OnNext(T data) – called by observable when the next piece of data is ready • void OnError(Exception ex) – called by observable when an error occurs • void OnCompleted() – called by observable when the pull operation has completed
  • 8. OBSERVABLE STATIC CLASS • IObserable/IObserver are all well and good, but we really could’ve done that without Rx • Observable/Observer provide static methods to create Observables/Observers without class definitions • Provides a whole bunch of options • Separate install (can be installed from NuGet)
  • 10. SCHEDULER • By default, Observable will automatically schedule itself on a certain thread, by default it uses TaskPool • You can control this by passing in a scheduler • ImmediateScheduler, CurrentThreadScheduler, DispatcherScheduler, NewThreadScheduler, TaskPoolScheduler, ThreadPoolScheduler • Example Code!
  • 11. RX AND LINQ • Rx adds a few new LINQ extension methods, as well as uses the existing ones • Example Code!
  • 12. OBSERVABLE SUBJECT • Subject is a proxy class you can use to wrap a non-pull system and create an observable • Implements both IObservable<T> and IObserver<T> • Example Code!
  • 13. IQBSERVABLE • Combines LINQ’s Queryable and Rx’s Observable functionality • Queryable – allows you to create a query client side using LINQ, and pass that query to a data source (server, database, web service, etc) • Observable – instead of blocking until the data comes back, will just let you know when it gets the data