SlideShare a Scribd company logo
Your systems. Working as one. 
Reactive Stream Processingusing DDSand Rx 
www.rti.com 
Sumant Tambe, Ph.D. 
Senior Software Research Engineer and Microsoft MVP 
Real-Time Innovations, Inc. 
@sutambe 
Oct. 11, 2014
Outline 
•Reactive Systems 
•Stream Processing 
•Overview of Reactive Extensions 
•Overview of DDS 
•Streaming Shapes Demo in C# 
10/10/2014 Real-Time Innovations, Inc. 2
Systems Everyone Wants to Build 
•Event-Driven:Modular, pipelined, asynchronous 
•Elasic:Scales easily up/down with load and cpucores. 
•Resilient:fault-tolerant 
•Responsive:Reacts to events at the speed of environment 
10/10/2014 Real-Time Innovations, Inc. 3 
Networking Middleware 
App
Stream Processing 
•Stream Processing is the term used to describe an architectural style that operate on a continuous sequence of data. 
10/10/2014 Real-Time Innovations, Inc. 4
Shape of an application 
o/p 
Where 
Once 
CombineLatest 
Select 
Scan 
Merge 
Raw Data 
i/p
*nix command line (pipes and filter) 
$ ls-1 | grep“search” | grep“research” 
research 
$ 
10/10/2014 Real-Time Innovations, Inc. 6 
$ cat -| grep“Real” 
R 
Real 
Real 
[Ctrl+C] 
$
Reactive Extensions 
•The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observablesequences 
•Rx = Observables + Composition + Schedulers 
•Streams are first-class 
•Filter, project, aggregate, compose and perform time-based operations on multiple streams 
•Uses Functional Programming Style 
•Rx.NET, RxJava, RxJS, RxCpp, RxRuby, RxPyton, and more… 
10/10/2014 Real-Time Innovations, Inc. 7
10/10/2014 Real-Time Innovations, Inc. 8 
Data Distribution Service (DDS) 
A Reactive Middleware
DDS: Standards-based Integration Infrastructure forCritical Applications 
© 2009 Real-Time Innovations, Inc. 
StreamingData 
Sensors 
Events 
Real-Time 
Applications 
Enterprise 
Applications 
Actuators
Systems that interact with the Real World 
•Must adapt to changing environment 
•Cannot stop processing the information 
•Live within world-imposed timing 
Beyond traditional interpretation of real-time 
© 2010 Real-Time Innovations, Inc.
Real-Time Data Distribution 
10/10/2014 © 2012 RTI • COMPANY 11
RPC over DDS 
2014 
DDS 
Security 
2012 
Family of Specifications 
© 2009 Real-Time Innovations, Inc. COMPANY 
12 
DDS 
Implementation 
Network / TCP / UDP / IP 
App 
DDS 
Implementation 
App 
DDS 
Implementation 
DDS Spec 
2004 
DDS 
Interoperablity 
2006 
UML Profile 
for DDS 
2008 
DDS for 
Lw CCM 
2009 
DDS 
X-Types 
2010 
2010 
DDS-STD-C++ 
DDS-JAVA5 
App
Evolution of DataBus 
Data-centricity basics
Everyday Example: Schedule Meeting via Emails 
Alternative Process #1 (message-centric): 
1.Email: “Meeting Monday at 10:00.” 
2.Email: “Here’s dial-in info for meeting…” 
3.Email: “Meeting moved to Tuesday” 
4.You: “Where do I have to be? When?” 
5.You: (sifting through email messages…) 
14
Everyday Example: Schedule Meeting Using a Calendar 
Alternative Process #2: 
1.Calendar: (add meeting Monday at 10:00) 
2.Calendar: (add dial-in info) 
3.Calendar: (move meeting to Tuesday) 
4.You: “Where do I have to be? When?” 
5.You: (check calendar. Contains consolidated-state) 
15 
The difference is state! 
The infrastructure consolidates changes and maintains it
10/10/2014 © 2012 RTI • COMPANY 16 
DDS Communication Model
DDS for Distribution, Rx for Processing 
10/10/2014 Real-Time Innovations, Inc. 17 
DR 
DR 
DR 
Observable 
Observer 
DW 
DW 
Processing
Rx4DDS.NET = DDS + Rx 
10/10/2014 © 2012 RTI • COMPANY 18 
•DDS wrapper for Rx.NET 
•In C# 
•Anything that produces data is an Observable 
–Topics, Discovery, Statuses, statuses, etc.
DDS and Rx: A Great Match 
10/10/2014 © 2012 RTI • COMPANY 19 
DDS Concept 
Rx Concept/Type/Operator 
Topic of type T 
An objectthat implements IObservable<T>, which internally creates a DataReader<T> 
Communication status, Discovery event streams 
IObservable<SampleLostStatus> 
IObservable<SubscriptionBuiltinTopicData> 
Topic of type T with key type=Key 
IObservable<IGroupedObservable<Key, T>> 
Detect a new instance 
Notify Observers about a new IGroupedObservable<Key, T>with key==instance. Invoke IObserver<IGroupedObservable<Key, T>>.OnNext() 
Dispose an instance 
Notify Observers through IObserver<IGroupedObservable<Key,T>>.OnCompleted() 
Take an instance update of type T 
Notify Observers about a new value of T using Iobserver<T>.OnNext() 
Readwith history=N 
IObservable<T>.Replay(N)(Produces a new IObservable<T>)
DDS and Rx: A Great Match 
10/10/2014 © 2012 RTI • COMPANY 20 
DDS Concept 
Rx Concept/Type/Operation 
QueryConditions 
Iobservable<T>.Where(…) OR 
Iobservable<T>.GroupBy(…) 
SELECT in CFT expression 
IObservable<T>.Select(...) 
FROM in CFT expression 
DDSObservable.FromTopic(“Topic1”) 
DDSObservable.FromKeyedTopic(“Topic2”) 
WHEREin CFT expression 
IObservable<T>.Where(...) 
ORDER BY in CFT expression 
IObservable<T>.OrderBy(...) 
MultiTopic(INNER JOIN) 
IObservable<T>.Join(...) 
.Where(...) 
.Select(...) 
Join between DDS and non- DDS data 
Join, CombineLatest, Zip
Living Demo in C# 
10/10/2014 Real-Time Innovations, Inc. 21
Background Code 
10/12/2014 Real-Time Innovations, Inc. 22 
publicclassShapeType: ICopyable<ShapeType> { publicstringcolor; publicintshapesize; publicintx; publicinty; publicShapeType(); } publicclassShapeTypeExtended: ShapeType{ publicfloatangle; publicShapeFillKindfillKind; publicShapeTypeExtended(); } privateDDS.TypedDataWriter<ShapeTypeExtended> triangle_writer;
Flower Demo 
10/12/2014 Real-Time Innovations, Inc. 23 
IDisposableflower(DDS.DomainParticipantparticipant) { inta = 30, b = 30, c = 10; returnObservable.Interval(TimeSpan.FromMilliseconds(1), Scheduler.Immediate) .Select((longx) => { intangle = (int)(x % 360); returnnewShapeTypeExtended{ x = (int)(120 + (a + b) * Math.Cos(angle) + b * Math.Cos((a / b -c) * angle)), y = (int)(120 + (a + b) * Math.Sin(angle) + b * Math.Sin((a / b -c) * angle)), color = "GREEN", shapesize= 5}; }) .Subscribe(triangle_writer); }
Simple Square to Triangle Transformation 
10/12/2014 Real-Time Innovations, Inc. 24 
IDisposableforward_verbose(DDS.DomainParticipantparticipant) { varrx_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square"); IDisposabledisposable = rx_reader.OnDataAvailable((ShapeTypeExtendedshape) => { DDS.InstanceHandle_thandle = DDS.InstanceHandle_t.HANDLE_NIL; triangle_writer.write(shape, refhandle); }); returndisposable; } IDisposableforward_shortest(DDS.DomainParticipantparticipant) { returnDDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square") .OnDataAvailable(triangle_writer); }
Swap Square’s x and y and Propagate Stream Dispose Event 
10/12/2014 Real-Time Innovations, Inc. 25 
IDisposableswap(DDS.DomainParticipantparticipant) { returnDDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square") .Select(shape => newShapeTypeExtended{ x = shape.y, y = shape.x, color = shape.color, shapesize= shape.shapesize}) .SubscribeAndDisposeOnCompleted(triangle_writer, newShapeTypeExtended{ color = "BLUE"}); }
Aggregator (Square + Circle = Triangle!) 
10/12/2014 Real-Time Innovations, Inc. 26 
IDisposableaggregator(DDS.DomainParticipantparticipant) { varrx_square_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square"); varrx_circle_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Circle"); returnnewCompositeDisposable( newIDisposable[] { rx_square_reader.Subscribe(triangle_writer), rx_circle_reader.Subscribe(triangle_writer) } ); }
Square/Circle Correlatorusing LINQ 
10/12/2014 Real-Time Innovations, Inc. 27 
IDisposableselectmany_correlator(DDS.DomainParticipantparticipant, booluseLinq) { varrx_circle_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Circle", Scheduler.Default); varrx_square_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square", Scheduler.Default); varcorrelator= fromsquare inrx_square_readerfromcircle inrx_circle_reader.Take(1) wheresquare.color== circle.colorselectnewShapeTypeExtended{ x = square.x, y = square.y, color = square.color, shapesize= circle.x}; returncorrelator.Subscribe(triangle_writer); }
Thank You! 
•Rx4DDS.NET 
–https://github.com/rticommunity/rticonnextdds-reactive 
•Data Distribution Service 
–http://portals.omg.org/dds 
•Real-Time Innovations, Inc. 
–www.rti.com 
10/12/2014 Real-Time Innovations, Inc. 28

More Related Content

What's hot (20)

PPTX
Kapacitor - Real Time Data Processing Engine
Prashant Vats
 
PPT
Big-data-analysis-training-in-mumbai
Unmesh Baile
 
PDF
Ge aviation spark application experience porting analytics into py spark ml p...
Databricks
 
PDF
ADMM-Based Scalable Machine Learning on Apache Spark with Sauptik Dhar and Mo...
Databricks
 
PDF
Scaling up data science applications
Kexin Xie
 
PDF
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Data Provenance Support in...
Data Con LA
 
PPTX
Distributed GLM with H2O - Atlanta Meetup
Sri Ambati
 
PDF
Sketching Data with T-Digest In Apache Spark: Spark Summit East talk by Erik ...
Spark Summit
 
PPTX
Large Scale Machine Learning with Apache Spark
Cloudera, Inc.
 
PPTX
Chris Hillman – Beyond Mapreduce Scientific Data Processing in Real-time
Flink Forward
 
PDF
Optimizing Terascale Machine Learning Pipelines with Keystone ML
Spark Summit
 
PDF
Batch and Stream Graph Processing with Apache Flink
Vasia Kalavri
 
PDF
World’s Best Data Modeling Tool
Artem Chebotko
 
PDF
Vasia Kalavri – Training: Gelly School
Flink Forward
 
PDF
Time-Evolving Graph Processing On Commodity Clusters
Jen Aman
 
PPTX
Data Stream Algorithms in Storm and R
Radek Maciaszek
 
PDF
A Graph-Based Method For Cross-Entity Threat Detection
Jen Aman
 
PDF
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
Spark Summit
 
PDF
Introduction into scalable graph analysis with Apache Giraph and Spark GraphX
rhatr
 
PDF
Ernest: Efficient Performance Prediction for Advanced Analytics on Apache Spa...
Spark Summit
 
Kapacitor - Real Time Data Processing Engine
Prashant Vats
 
Big-data-analysis-training-in-mumbai
Unmesh Baile
 
Ge aviation spark application experience porting analytics into py spark ml p...
Databricks
 
ADMM-Based Scalable Machine Learning on Apache Spark with Sauptik Dhar and Mo...
Databricks
 
Scaling up data science applications
Kexin Xie
 
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Data Provenance Support in...
Data Con LA
 
Distributed GLM with H2O - Atlanta Meetup
Sri Ambati
 
Sketching Data with T-Digest In Apache Spark: Spark Summit East talk by Erik ...
Spark Summit
 
Large Scale Machine Learning with Apache Spark
Cloudera, Inc.
 
Chris Hillman – Beyond Mapreduce Scientific Data Processing in Real-time
Flink Forward
 
Optimizing Terascale Machine Learning Pipelines with Keystone ML
Spark Summit
 
Batch and Stream Graph Processing with Apache Flink
Vasia Kalavri
 
World’s Best Data Modeling Tool
Artem Chebotko
 
Vasia Kalavri – Training: Gelly School
Flink Forward
 
Time-Evolving Graph Processing On Commodity Clusters
Jen Aman
 
Data Stream Algorithms in Storm and R
Radek Maciaszek
 
A Graph-Based Method For Cross-Entity Threat Detection
Jen Aman
 
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
Spark Summit
 
Introduction into scalable graph analysis with Apache Giraph and Spark GraphX
rhatr
 
Ernest: Efficient Performance Prediction for Advanced Analytics on Apache Spa...
Spark Summit
 

Viewers also liked (7)

PDF
Reactive Programming in Java by Mario Fusco - Codemotion Rome 2015
Codemotion
 
PDF
Reactive Stream Processing in Industrial IoT using DDS and Rx
Sumant Tambe
 
PDF
Functional Reactive Programming in the Netflix API
C4Media
 
PDF
Reactive programming with Rxjava
Christophe Marchal
 
PPT
Java 8 Streams
Manvendra Singh
 
PDF
Reactive programming in Angular 2
Yakov Fain
 
PPTX
RxJS and Reactive Programming - Modern Web UI - May 2015
Ben Lesh
 
Reactive Programming in Java by Mario Fusco - Codemotion Rome 2015
Codemotion
 
Reactive Stream Processing in Industrial IoT using DDS and Rx
Sumant Tambe
 
Functional Reactive Programming in the Netflix API
C4Media
 
Reactive programming with Rxjava
Christophe Marchal
 
Java 8 Streams
Manvendra Singh
 
Reactive programming in Angular 2
Yakov Fain
 
RxJS and Reactive Programming - Modern Web UI - May 2015
Ben Lesh
 
Ad

Similar to Reactive Stream Processing Using DDS and Rx (20)

PDF
Reactive Stream Processing for Data-centric Publish/Subscribe
Sumant Tambe
 
PPT
RTI Data-Distribution Service (DDS) Master Class 2011
Gerardo Pardo-Castellote
 
PPTX
Reactive Programming with DDS and RX
sivakkasi
 
PPTX
DDS: The data-centric future beyond message-based integration
Gerardo Pardo-Castellote
 
PDF
Communication Patterns Using Data-Centric Publish/Subscribe
Real-Time Innovations (RTI)
 
PDF
Communication Patterns Using Data-Centric Publish/Subscribe
Sumant Tambe
 
PPTX
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
Jaime Martin Losa
 
PPTX
Developing Mission-Critical Avionics and Defense Systems with Ada and DDS
Real-Time Innovations (RTI)
 
PPTX
Introduction to DDS
Rick Warren
 
PDF
DDS Best Practices
Gerardo Pardo-Castellote
 
PPT
DDS 2010 Interoperability Demo
Angelo Corsaro
 
PDF
Open splicedds espercep-webinar
Tomasz Waszczyk
 
PPTX
Distributed Systems: How to connect your real-time applications
Jaime Martin Losa
 
PDF
The Data Distribution Service Tutorial
Angelo Corsaro
 
PDF
DDS Interoperability Demo June 2013 (Berlin, Germany)
Gerardo Pardo-Castellote
 
PDF
Reactive Extensions
Dmitri Nesteruk
 
PDF
Dds the ideal_bus_for_event_processing_engines
Gerardo Pardo-Castellote
 
PPTX
Quick look in Reactive Extensions
johnlvidal
 
PDF
Reactive Systems with Data Distribution Service (DDS)
Abdullah Ozturk
 
PDF
Beyond messaging
Angelo Corsaro
 
Reactive Stream Processing for Data-centric Publish/Subscribe
Sumant Tambe
 
RTI Data-Distribution Service (DDS) Master Class 2011
Gerardo Pardo-Castellote
 
Reactive Programming with DDS and RX
sivakkasi
 
DDS: The data-centric future beyond message-based integration
Gerardo Pardo-Castellote
 
Communication Patterns Using Data-Centric Publish/Subscribe
Real-Time Innovations (RTI)
 
Communication Patterns Using Data-Centric Publish/Subscribe
Sumant Tambe
 
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
Jaime Martin Losa
 
Developing Mission-Critical Avionics and Defense Systems with Ada and DDS
Real-Time Innovations (RTI)
 
Introduction to DDS
Rick Warren
 
DDS Best Practices
Gerardo Pardo-Castellote
 
DDS 2010 Interoperability Demo
Angelo Corsaro
 
Open splicedds espercep-webinar
Tomasz Waszczyk
 
Distributed Systems: How to connect your real-time applications
Jaime Martin Losa
 
The Data Distribution Service Tutorial
Angelo Corsaro
 
DDS Interoperability Demo June 2013 (Berlin, Germany)
Gerardo Pardo-Castellote
 
Reactive Extensions
Dmitri Nesteruk
 
Dds the ideal_bus_for_event_processing_engines
Gerardo Pardo-Castellote
 
Quick look in Reactive Extensions
johnlvidal
 
Reactive Systems with Data Distribution Service (DDS)
Abdullah Ozturk
 
Beyond messaging
Angelo Corsaro
 
Ad

More from Sumant Tambe (14)

PDF
Kafka tiered-storage-meetup-2022-final-presented
Sumant Tambe
 
PPTX
Systematic Generation Data and Types in C++
Sumant Tambe
 
PPTX
Tuning kafka pipelines
Sumant Tambe
 
PPTX
New Tools for a More Functional C++
Sumant Tambe
 
PDF
RPC over DDS Beta 1
Sumant Tambe
 
PPTX
Fun with Lambdas: C++14 Style (part 2)
Sumant Tambe
 
PDF
Fun with Lambdas: C++14 Style (part 1)
Sumant Tambe
 
PDF
An Extensible Architecture for Avionics Sensor Health Assessment Using DDS
Sumant Tambe
 
PDF
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDS
Sumant Tambe
 
PDF
Standardizing the Data Distribution Service (DDS) API for Modern C++
Sumant Tambe
 
PDF
C++11 Idioms @ Silicon Valley Code Camp 2012
Sumant Tambe
 
PPTX
Retargeting Embedded Software Stack for Many-Core Systems
Sumant Tambe
 
PPTX
Ph.D. Dissertation
Sumant Tambe
 
PDF
Native XML processing in C++ (BoostCon'11)
Sumant Tambe
 
Kafka tiered-storage-meetup-2022-final-presented
Sumant Tambe
 
Systematic Generation Data and Types in C++
Sumant Tambe
 
Tuning kafka pipelines
Sumant Tambe
 
New Tools for a More Functional C++
Sumant Tambe
 
RPC over DDS Beta 1
Sumant Tambe
 
Fun with Lambdas: C++14 Style (part 2)
Sumant Tambe
 
Fun with Lambdas: C++14 Style (part 1)
Sumant Tambe
 
An Extensible Architecture for Avionics Sensor Health Assessment Using DDS
Sumant Tambe
 
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDS
Sumant Tambe
 
Standardizing the Data Distribution Service (DDS) API for Modern C++
Sumant Tambe
 
C++11 Idioms @ Silicon Valley Code Camp 2012
Sumant Tambe
 
Retargeting Embedded Software Stack for Many-Core Systems
Sumant Tambe
 
Ph.D. Dissertation
Sumant Tambe
 
Native XML processing in C++ (BoostCon'11)
Sumant Tambe
 

Recently uploaded (20)

PDF
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
PDF
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PPTX
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
PPTX
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PDF
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
PPT
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PDF
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
How Industrial Project Management Differs From Construction.pptx
jamespit799
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
How Industrial Project Management Differs From Construction.pptx
jamespit799
 
MRRS Strength and Durability of Concrete
CivilMythili
 
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 

Reactive Stream Processing Using DDS and Rx

  • 1. Your systems. Working as one. Reactive Stream Processingusing DDSand Rx www.rti.com Sumant Tambe, Ph.D. Senior Software Research Engineer and Microsoft MVP Real-Time Innovations, Inc. @sutambe Oct. 11, 2014
  • 2. Outline •Reactive Systems •Stream Processing •Overview of Reactive Extensions •Overview of DDS •Streaming Shapes Demo in C# 10/10/2014 Real-Time Innovations, Inc. 2
  • 3. Systems Everyone Wants to Build •Event-Driven:Modular, pipelined, asynchronous •Elasic:Scales easily up/down with load and cpucores. •Resilient:fault-tolerant •Responsive:Reacts to events at the speed of environment 10/10/2014 Real-Time Innovations, Inc. 3 Networking Middleware App
  • 4. Stream Processing •Stream Processing is the term used to describe an architectural style that operate on a continuous sequence of data. 10/10/2014 Real-Time Innovations, Inc. 4
  • 5. Shape of an application o/p Where Once CombineLatest Select Scan Merge Raw Data i/p
  • 6. *nix command line (pipes and filter) $ ls-1 | grep“search” | grep“research” research $ 10/10/2014 Real-Time Innovations, Inc. 6 $ cat -| grep“Real” R Real Real [Ctrl+C] $
  • 7. Reactive Extensions •The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observablesequences •Rx = Observables + Composition + Schedulers •Streams are first-class •Filter, project, aggregate, compose and perform time-based operations on multiple streams •Uses Functional Programming Style •Rx.NET, RxJava, RxJS, RxCpp, RxRuby, RxPyton, and more… 10/10/2014 Real-Time Innovations, Inc. 7
  • 8. 10/10/2014 Real-Time Innovations, Inc. 8 Data Distribution Service (DDS) A Reactive Middleware
  • 9. DDS: Standards-based Integration Infrastructure forCritical Applications © 2009 Real-Time Innovations, Inc. StreamingData Sensors Events Real-Time Applications Enterprise Applications Actuators
  • 10. Systems that interact with the Real World •Must adapt to changing environment •Cannot stop processing the information •Live within world-imposed timing Beyond traditional interpretation of real-time © 2010 Real-Time Innovations, Inc.
  • 11. Real-Time Data Distribution 10/10/2014 © 2012 RTI • COMPANY 11
  • 12. RPC over DDS 2014 DDS Security 2012 Family of Specifications © 2009 Real-Time Innovations, Inc. COMPANY 12 DDS Implementation Network / TCP / UDP / IP App DDS Implementation App DDS Implementation DDS Spec 2004 DDS Interoperablity 2006 UML Profile for DDS 2008 DDS for Lw CCM 2009 DDS X-Types 2010 2010 DDS-STD-C++ DDS-JAVA5 App
  • 13. Evolution of DataBus Data-centricity basics
  • 14. Everyday Example: Schedule Meeting via Emails Alternative Process #1 (message-centric): 1.Email: “Meeting Monday at 10:00.” 2.Email: “Here’s dial-in info for meeting…” 3.Email: “Meeting moved to Tuesday” 4.You: “Where do I have to be? When?” 5.You: (sifting through email messages…) 14
  • 15. Everyday Example: Schedule Meeting Using a Calendar Alternative Process #2: 1.Calendar: (add meeting Monday at 10:00) 2.Calendar: (add dial-in info) 3.Calendar: (move meeting to Tuesday) 4.You: “Where do I have to be? When?” 5.You: (check calendar. Contains consolidated-state) 15 The difference is state! The infrastructure consolidates changes and maintains it
  • 16. 10/10/2014 © 2012 RTI • COMPANY 16 DDS Communication Model
  • 17. DDS for Distribution, Rx for Processing 10/10/2014 Real-Time Innovations, Inc. 17 DR DR DR Observable Observer DW DW Processing
  • 18. Rx4DDS.NET = DDS + Rx 10/10/2014 © 2012 RTI • COMPANY 18 •DDS wrapper for Rx.NET •In C# •Anything that produces data is an Observable –Topics, Discovery, Statuses, statuses, etc.
  • 19. DDS and Rx: A Great Match 10/10/2014 © 2012 RTI • COMPANY 19 DDS Concept Rx Concept/Type/Operator Topic of type T An objectthat implements IObservable<T>, which internally creates a DataReader<T> Communication status, Discovery event streams IObservable<SampleLostStatus> IObservable<SubscriptionBuiltinTopicData> Topic of type T with key type=Key IObservable<IGroupedObservable<Key, T>> Detect a new instance Notify Observers about a new IGroupedObservable<Key, T>with key==instance. Invoke IObserver<IGroupedObservable<Key, T>>.OnNext() Dispose an instance Notify Observers through IObserver<IGroupedObservable<Key,T>>.OnCompleted() Take an instance update of type T Notify Observers about a new value of T using Iobserver<T>.OnNext() Readwith history=N IObservable<T>.Replay(N)(Produces a new IObservable<T>)
  • 20. DDS and Rx: A Great Match 10/10/2014 © 2012 RTI • COMPANY 20 DDS Concept Rx Concept/Type/Operation QueryConditions Iobservable<T>.Where(…) OR Iobservable<T>.GroupBy(…) SELECT in CFT expression IObservable<T>.Select(...) FROM in CFT expression DDSObservable.FromTopic(“Topic1”) DDSObservable.FromKeyedTopic(“Topic2”) WHEREin CFT expression IObservable<T>.Where(...) ORDER BY in CFT expression IObservable<T>.OrderBy(...) MultiTopic(INNER JOIN) IObservable<T>.Join(...) .Where(...) .Select(...) Join between DDS and non- DDS data Join, CombineLatest, Zip
  • 21. Living Demo in C# 10/10/2014 Real-Time Innovations, Inc. 21
  • 22. Background Code 10/12/2014 Real-Time Innovations, Inc. 22 publicclassShapeType: ICopyable<ShapeType> { publicstringcolor; publicintshapesize; publicintx; publicinty; publicShapeType(); } publicclassShapeTypeExtended: ShapeType{ publicfloatangle; publicShapeFillKindfillKind; publicShapeTypeExtended(); } privateDDS.TypedDataWriter<ShapeTypeExtended> triangle_writer;
  • 23. Flower Demo 10/12/2014 Real-Time Innovations, Inc. 23 IDisposableflower(DDS.DomainParticipantparticipant) { inta = 30, b = 30, c = 10; returnObservable.Interval(TimeSpan.FromMilliseconds(1), Scheduler.Immediate) .Select((longx) => { intangle = (int)(x % 360); returnnewShapeTypeExtended{ x = (int)(120 + (a + b) * Math.Cos(angle) + b * Math.Cos((a / b -c) * angle)), y = (int)(120 + (a + b) * Math.Sin(angle) + b * Math.Sin((a / b -c) * angle)), color = "GREEN", shapesize= 5}; }) .Subscribe(triangle_writer); }
  • 24. Simple Square to Triangle Transformation 10/12/2014 Real-Time Innovations, Inc. 24 IDisposableforward_verbose(DDS.DomainParticipantparticipant) { varrx_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square"); IDisposabledisposable = rx_reader.OnDataAvailable((ShapeTypeExtendedshape) => { DDS.InstanceHandle_thandle = DDS.InstanceHandle_t.HANDLE_NIL; triangle_writer.write(shape, refhandle); }); returndisposable; } IDisposableforward_shortest(DDS.DomainParticipantparticipant) { returnDDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square") .OnDataAvailable(triangle_writer); }
  • 25. Swap Square’s x and y and Propagate Stream Dispose Event 10/12/2014 Real-Time Innovations, Inc. 25 IDisposableswap(DDS.DomainParticipantparticipant) { returnDDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square") .Select(shape => newShapeTypeExtended{ x = shape.y, y = shape.x, color = shape.color, shapesize= shape.shapesize}) .SubscribeAndDisposeOnCompleted(triangle_writer, newShapeTypeExtended{ color = "BLUE"}); }
  • 26. Aggregator (Square + Circle = Triangle!) 10/12/2014 Real-Time Innovations, Inc. 26 IDisposableaggregator(DDS.DomainParticipantparticipant) { varrx_square_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square"); varrx_circle_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Circle"); returnnewCompositeDisposable( newIDisposable[] { rx_square_reader.Subscribe(triangle_writer), rx_circle_reader.Subscribe(triangle_writer) } ); }
  • 27. Square/Circle Correlatorusing LINQ 10/12/2014 Real-Time Innovations, Inc. 27 IDisposableselectmany_correlator(DDS.DomainParticipantparticipant, booluseLinq) { varrx_circle_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Circle", Scheduler.Default); varrx_square_reader= DDSObservable.FromTopic<ShapeTypeExtended>(participant, "Square", Scheduler.Default); varcorrelator= fromsquare inrx_square_readerfromcircle inrx_circle_reader.Take(1) wheresquare.color== circle.colorselectnewShapeTypeExtended{ x = square.x, y = square.y, color = square.color, shapesize= circle.x}; returncorrelator.Subscribe(triangle_writer); }
  • 28. Thank You! •Rx4DDS.NET –https://github.com/rticommunity/rticonnextdds-reactive •Data Distribution Service –http://portals.omg.org/dds •Real-Time Innovations, Inc. –www.rti.com 10/12/2014 Real-Time Innovations, Inc. 28