This document discusses reactive programming in Angular 2 using RxJS. It introduces Observables and Observable operators like map, filter, and switchMap. It explains how to use Observables with HTTP requests, forms, and routing in Angular. Key concepts covered include creating Observables, subscribing to them, transforming streams with operators, and sharing Observables between subscribers.
The document discusses reactive programming concepts in Java using RxJava. It defines key RxJava terms like Observable, Observer, and Operator. It explains how RxJava uses asynchronous message passing with Observables that push data to Observer subscribers, unlike traditional Java APIs that use synchronous pulling of data. It provides examples of creating Observables and applying operators like map, filter, and flatMap. It also covers multi-threading in RxJava using schedulers, backpressure, and other advanced topics.
This document provides an overview of Reactive Streams and RxJava2. It discusses key concepts like asynchronous programming, backpressure, Observables, Operators, Schedulers, and parallel processing. Reactive programming allows for data to flow through streams and algorithms in a resilient and message-driven way while hiding threading complexity. RxJava2 implements the Reactive Streams specification and provides APIs like Observable and Flowable to build reactive applications that can handle failures and chain asynchronous operations.
Yakov Fain discusses reactive programming with RxJava2. He begins by describing the challenges of asynchronous and multi-threaded programming that reactive programming addresses. He then covers key RxJava2 concepts like Observables, Operators, Backpressure, and Schedulers. The document provides examples of creating Observables and Subscribers and using various operators to transform and compose Observable streams in a reactive and functional way.
Reactive programming with Rx-Java allows building responsive systems that can handle varying workloads and failures. It promotes asynchronous and non-blocking code using observable sequences and operators. Rx-Java was created at Netflix to address issues like network chattiness and callback hell in their API. It transforms callback-based code into declarative pipelines. Key concepts are Observables that emit notifications, Operators that transform Observables, and Subscribers that receive emitted items. Rx-Java gained popularity due to its support for concurrency, error handling, and composability.
RxJava is a library for composing asynchronous and event-based programs using observable sequences for the Java VM. It provides APIs for asynchronous programming with observable streams. Reactive Extensions (Rx) is a library that supports reactive programming with observable streams in many languages. Netflix adopted RxJava to address issues with its legacy API and improve performance of its services. RxJava uses Observables to build responsive and resilient applications in a reactive style.
This document discusses using RxJava to handle asynchronous and concurrent processes. It provides an example of using RxJava to stream tweets from Twitter APIs, retrieve user profiles concurrently, and find the most popular tweet by a user. Key strengths of RxJava highlighted are that it is functional, reactive, allows controlling execution threads, and is easy to compose and integrate workflows. Some pitfalls mentioned are that the API is large, it can be hard to debug, and back pressure must be managed.
Building Scalable Stateless Applications with RxJavaRick Warren
RxJava is a lightweight open-source library, originally from Netflix, that makes it easy to compose asynchronous data sources and operations. This presentation is a high-level intro to this library and how it can fit into your application.
MobX is a state management library that makes state reactive by making it observable. It works well with React by re-rendering components when the observable state changes. MobX adds observable capabilities to existing data structures like objects and arrays. Components can be made reactive by using the @observer decorator, which forces re-rendering when observable data changes. Actions are used to explicitly define state modifications and provide debugging information. Computed values automatically re-calculate when dependencies change. MobX includes tools for visualizing component re-rendering and state changes.
The document discusses reactive programming concepts in Java using RxJava. It defines key RxJava terms like Observable, Observer, and Operator. It explains how RxJava uses asynchronous message passing with Observables that push data to Observer subscribers, unlike traditional Java APIs that use synchronous pulling of data. It provides examples of creating Observables and applying operators like map, filter, and flatMap. It also covers multi-threading in RxJava using schedulers, backpressure, and other advanced topics.
This document provides an overview of Reactive Streams and RxJava2. It discusses key concepts like asynchronous programming, backpressure, Observables, Operators, Schedulers, and parallel processing. Reactive programming allows for data to flow through streams and algorithms in a resilient and message-driven way while hiding threading complexity. RxJava2 implements the Reactive Streams specification and provides APIs like Observable and Flowable to build reactive applications that can handle failures and chain asynchronous operations.
Yakov Fain discusses reactive programming with RxJava2. He begins by describing the challenges of asynchronous and multi-threaded programming that reactive programming addresses. He then covers key RxJava2 concepts like Observables, Operators, Backpressure, and Schedulers. The document provides examples of creating Observables and Subscribers and using various operators to transform and compose Observable streams in a reactive and functional way.
Reactive programming with Rx-Java allows building responsive systems that can handle varying workloads and failures. It promotes asynchronous and non-blocking code using observable sequences and operators. Rx-Java was created at Netflix to address issues like network chattiness and callback hell in their API. It transforms callback-based code into declarative pipelines. Key concepts are Observables that emit notifications, Operators that transform Observables, and Subscribers that receive emitted items. Rx-Java gained popularity due to its support for concurrency, error handling, and composability.
RxJava is a library for composing asynchronous and event-based programs using observable sequences for the Java VM. It provides APIs for asynchronous programming with observable streams. Reactive Extensions (Rx) is a library that supports reactive programming with observable streams in many languages. Netflix adopted RxJava to address issues with its legacy API and improve performance of its services. RxJava uses Observables to build responsive and resilient applications in a reactive style.
This document discusses using RxJava to handle asynchronous and concurrent processes. It provides an example of using RxJava to stream tweets from Twitter APIs, retrieve user profiles concurrently, and find the most popular tweet by a user. Key strengths of RxJava highlighted are that it is functional, reactive, allows controlling execution threads, and is easy to compose and integrate workflows. Some pitfalls mentioned are that the API is large, it can be hard to debug, and back pressure must be managed.
Building Scalable Stateless Applications with RxJavaRick Warren
RxJava is a lightweight open-source library, originally from Netflix, that makes it easy to compose asynchronous data sources and operations. This presentation is a high-level intro to this library and how it can fit into your application.
MobX is a state management library that makes state reactive by making it observable. It works well with React by re-rendering components when the observable state changes. MobX adds observable capabilities to existing data structures like objects and arrays. Components can be made reactive by using the @observer decorator, which forces re-rendering when observable data changes. Actions are used to explicitly define state modifications and provide debugging information. Computed values automatically re-calculate when dependencies change. MobX includes tools for visualizing component re-rendering and state changes.
A practical guide to using RxJava on Android. Tips for improving your app architecture with reactive programming. What are the advantages and disadvantages of using RxJava over standard architecture? And how to connect with other popular Android libraries?
Presented at GDG DevFest The Netherlands 2016.
RxJava is a library for composing asynchronous and event-based programs using observable sequences. It allows avoiding callback hell and makes it easy to compose and transform asynchronous processes through combining, filtering, etc. RxJava uses Observables to represent asynchronous data streams and allows subscribing to those streams using Observers. It supports asynchronous operations through Schedulers and can integrate with libraries like Retrofit to handle asynchronous network requests in a reactive way. Learning the RxJava concepts and operators takes some time but it provides many benefits for managing asynchronous code in a declarative way.
This document provides an introduction to Retrofit and RxJava. It discusses:
1. How Retrofit turns REST APIs into Java interfaces and handles JSON conversion.
2. What RxJava is and how it allows for composing asynchronous and event-based programs using observable sequences.
3. Examples of making HTTP requests with Retrofit, including defining services, making synchronous and asynchronous requests, and using callbacks and RxJava.
4. Key RxJava concepts like Observables, operators like map, flatMap, and zip, and threading.
The Road To Reactive with RxJava JEEConf 2016Frank Lyaruu
This document introduces Reactive Programming with RxJava and how it can be used to create non-blocking applications. It discusses the limitations of blocking code and how RxJava uses Observables and Subscribers to implement reactive and asynchronous operations. It provides examples of converting blocking servlets and HTTP calls to non-blocking using RxJava. While non-blocking code is not always faster, it allows asynchronous operations to utilize threads more efficiently.
Streams, Streams Everywhere! An Introduction to RxAndrzej Sitek
Nowadays users expect real time data - tweets, messages, order confirmations etc. - the user's attitude moved to the “push" model and it is high time for us devs to make that step as well.
Reactive Extensions (Rx) is the new hot stuff amongst developers these days. It is a library for composing asynchronous and event-based programs by using observable sequences. Sounds nice?
The only problem is that it can be a bit difficult to approach initially, especially when you come from an imperative world, but once mastered it helps dealing with some common problems in a nicer and cleaner way making your code more readable and easier to maintain.
Multiple implementations of Reactive Extensions helps reusing once learnt concepts between different programming languages. The aim of this talk is to provide a quick introduction to Rx theory and potential usecases. The examples are based on RxJava - the Java VM implementation of Reactive Extensions.
Bulding a reactive game engine with Spring 5 & CouchbaseAlex Derkach
A social game, by it’s nature can spread very quickly to a large user audience. Since a game is typically interactive, the speed of retrieving information needed for the user’s interactions with the system is critical. Applications which exclusively rely on synchronous data access, very often hit a scalability wall, when things get slow and their thread pools are exhausted. New paradigms like reactive programming alleviate this and provide extensive tool sets to deal with the ever growing demands of web applications.
This talk:
– Describes why Couchbase is the most appropriate solution for many video game and gaming use cases.
– Shows how to build scalable and reactive applications by making use of the Couchbase Java SDK 2.x, RxJava library and Spring Framework 5.
This document discusses RxJava, a library for composing asynchronous and event-based programs in Java. It introduces Observables as the core abstraction in RxJava, which are sequences that emit elements to observers. Operators like filter, map, and flatMap allow modifying and transforming Observables. As an example, it shows how to use RxJava to concurrently search for articles by ID, load each article, fetch like counts, and combine the results into a stream of articles. This is done by chaining flatMap operators to transform the stream of IDs into a stream of articles by asynchronously loading each part in parallel.
RxJava is an open source library for reactive programming that allows processing asynchronous streams of data. It provides operators to filter, transform, and combine Observables in a lazy manner. Observables represent asynchronous data streams that can be subscribed to receive push-based event notifications. Services return Observables to make their APIs asynchronous and reactive.
The document discusses reactive programming concepts using RxJava. It introduces observables and observers, where observables push asynchronous events to observers via subscriptions. It explains how to create observables that return asynchronous values, and how operators like map, filter, and flatMap can transform and combine observable streams. Key lessons are that performance depends on operator implementations, debugging subscriptions can be difficult, and IDE support for reactive code is still maturing.
RxJava is a library for composing asynchronous and event-based programs using observable sequences for the Java Virtual Machine. It implements Reactive Extensions Observables from Microsoft to provide an API for asynchronous programming with observable streams. RxJava supports Java, Groovy, Clojure, and Scala and is used by Netflix to build reactive applications by merging and transforming streams of data from various sources.
RxJava is a library for composing asynchronous and event-based programs using observable sequences. It avoids "callback hell" and supports streaming for performance benefits. While RxJava has a learning curve, it is important to start with streams, learn hot vs cold observables, always subscribe, and address issues like empty results. RxJava works best when subscribe code is separated and POJAM code is still used where possible. Its future looks promising with adoption in Android, JavaScript and Spring 5.
The document introduces RxJava and how it can be used in Android applications, describing key concepts like Observables, Observers, Operators, and Subjects that allow asynchronous and event-based code to be written in a reactive style. It provides examples of how RxJava can be used to fetch toilet data from an API and handle the asynchronous response more declaratively compared to using callbacks. The document also discusses how subjects can act as both observables that emit events and observers that receive events, making them useful for building event buses between activities.
Angular2 Development for Java developersYakov Fain
This document provides an overview of Angular 2 development for Java developers. It discusses key aspects of Angular 2 including components, templates, data binding, dependency injection, and routing. It also covers TypeScript and how it adds types, classes and interfaces to JavaScript. The document uses examples to demonstrate classes, interfaces, generics, and inheritance in TypeScript.
Angular & RXJS: examples and use casesFabio Biondi
The document discusses using RxJS in Angular applications. It provides examples of using RxJS operators like interval, map, async pipe, filter, switchMap, exhaustMap, tap, scan, and reduce. Common use cases include handling events, making HTTP requests, managing application state, and manipulating data. RxJS can be used in components, directives, services, routing, forms, and more throughout an Angular application.
This document discusses concurrency utilities introduced in Java 8 including parallel tasks, parallel streams, parallel array operations, CompletableFuture, ConcurrentHashMap, scalable updatable variables, and StampedLock. It provides examples and discusses when and how to properly use these utilities as well as potential performance issues. Resources for further reading on Java concurrency are also listed.
Reactive Programming on Android - RxAndroid - RxJavaAli Muzaffar
Introduction to RxJava for reactive programming and how to use RxAndroid to do reactive programming on Android.
There is a sample android app to go with the slides that has all the source shown in the project.
For most of us, Reactive Android means using RxJava. In this presentation, I try to borrow a few ideas from the backend world and enrich the concept of Reactive in Android.
This document provides an overview and agenda for a presentation on Angular for Java developers. The presentation will cover: generating an Angular project with Angular CLI; creating a Java REST service with Spring Boot; building an Angular REST client to interact with the Spring Boot backend; and demonstrating a sample Angular app using REST and WebSockets. It also briefly outlines key Angular concepts like components, dependency injection, routing, reactive programming with Observables, and forms.
This document provides an overview of Angular 2 for Java developers. It discusses that Angular 2 is a complete rewrite of AngularJS with a focus on components, better performance, and streamlined dependency injection. It also covers key aspects of Angular 2 like project structure, templates, data binding, dependency injection, routing, and use of reactive programming with RxJS. Sample code examples are provided to demonstrate concepts like components, services, dependency injection, routing, and use of observables.
A practical guide to using RxJava on Android. Tips for improving your app architecture with reactive programming. What are the advantages and disadvantages of using RxJava over standard architecture? And how to connect with other popular Android libraries?
Presented at GDG DevFest The Netherlands 2016.
RxJava is a library for composing asynchronous and event-based programs using observable sequences. It allows avoiding callback hell and makes it easy to compose and transform asynchronous processes through combining, filtering, etc. RxJava uses Observables to represent asynchronous data streams and allows subscribing to those streams using Observers. It supports asynchronous operations through Schedulers and can integrate with libraries like Retrofit to handle asynchronous network requests in a reactive way. Learning the RxJava concepts and operators takes some time but it provides many benefits for managing asynchronous code in a declarative way.
This document provides an introduction to Retrofit and RxJava. It discusses:
1. How Retrofit turns REST APIs into Java interfaces and handles JSON conversion.
2. What RxJava is and how it allows for composing asynchronous and event-based programs using observable sequences.
3. Examples of making HTTP requests with Retrofit, including defining services, making synchronous and asynchronous requests, and using callbacks and RxJava.
4. Key RxJava concepts like Observables, operators like map, flatMap, and zip, and threading.
The Road To Reactive with RxJava JEEConf 2016Frank Lyaruu
This document introduces Reactive Programming with RxJava and how it can be used to create non-blocking applications. It discusses the limitations of blocking code and how RxJava uses Observables and Subscribers to implement reactive and asynchronous operations. It provides examples of converting blocking servlets and HTTP calls to non-blocking using RxJava. While non-blocking code is not always faster, it allows asynchronous operations to utilize threads more efficiently.
Streams, Streams Everywhere! An Introduction to RxAndrzej Sitek
Nowadays users expect real time data - tweets, messages, order confirmations etc. - the user's attitude moved to the “push" model and it is high time for us devs to make that step as well.
Reactive Extensions (Rx) is the new hot stuff amongst developers these days. It is a library for composing asynchronous and event-based programs by using observable sequences. Sounds nice?
The only problem is that it can be a bit difficult to approach initially, especially when you come from an imperative world, but once mastered it helps dealing with some common problems in a nicer and cleaner way making your code more readable and easier to maintain.
Multiple implementations of Reactive Extensions helps reusing once learnt concepts between different programming languages. The aim of this talk is to provide a quick introduction to Rx theory and potential usecases. The examples are based on RxJava - the Java VM implementation of Reactive Extensions.
Bulding a reactive game engine with Spring 5 & CouchbaseAlex Derkach
A social game, by it’s nature can spread very quickly to a large user audience. Since a game is typically interactive, the speed of retrieving information needed for the user’s interactions with the system is critical. Applications which exclusively rely on synchronous data access, very often hit a scalability wall, when things get slow and their thread pools are exhausted. New paradigms like reactive programming alleviate this and provide extensive tool sets to deal with the ever growing demands of web applications.
This talk:
– Describes why Couchbase is the most appropriate solution for many video game and gaming use cases.
– Shows how to build scalable and reactive applications by making use of the Couchbase Java SDK 2.x, RxJava library and Spring Framework 5.
This document discusses RxJava, a library for composing asynchronous and event-based programs in Java. It introduces Observables as the core abstraction in RxJava, which are sequences that emit elements to observers. Operators like filter, map, and flatMap allow modifying and transforming Observables. As an example, it shows how to use RxJava to concurrently search for articles by ID, load each article, fetch like counts, and combine the results into a stream of articles. This is done by chaining flatMap operators to transform the stream of IDs into a stream of articles by asynchronously loading each part in parallel.
RxJava is an open source library for reactive programming that allows processing asynchronous streams of data. It provides operators to filter, transform, and combine Observables in a lazy manner. Observables represent asynchronous data streams that can be subscribed to receive push-based event notifications. Services return Observables to make their APIs asynchronous and reactive.
The document discusses reactive programming concepts using RxJava. It introduces observables and observers, where observables push asynchronous events to observers via subscriptions. It explains how to create observables that return asynchronous values, and how operators like map, filter, and flatMap can transform and combine observable streams. Key lessons are that performance depends on operator implementations, debugging subscriptions can be difficult, and IDE support for reactive code is still maturing.
RxJava is a library for composing asynchronous and event-based programs using observable sequences for the Java Virtual Machine. It implements Reactive Extensions Observables from Microsoft to provide an API for asynchronous programming with observable streams. RxJava supports Java, Groovy, Clojure, and Scala and is used by Netflix to build reactive applications by merging and transforming streams of data from various sources.
RxJava is a library for composing asynchronous and event-based programs using observable sequences. It avoids "callback hell" and supports streaming for performance benefits. While RxJava has a learning curve, it is important to start with streams, learn hot vs cold observables, always subscribe, and address issues like empty results. RxJava works best when subscribe code is separated and POJAM code is still used where possible. Its future looks promising with adoption in Android, JavaScript and Spring 5.
The document introduces RxJava and how it can be used in Android applications, describing key concepts like Observables, Observers, Operators, and Subjects that allow asynchronous and event-based code to be written in a reactive style. It provides examples of how RxJava can be used to fetch toilet data from an API and handle the asynchronous response more declaratively compared to using callbacks. The document also discusses how subjects can act as both observables that emit events and observers that receive events, making them useful for building event buses between activities.
Angular2 Development for Java developersYakov Fain
This document provides an overview of Angular 2 development for Java developers. It discusses key aspects of Angular 2 including components, templates, data binding, dependency injection, and routing. It also covers TypeScript and how it adds types, classes and interfaces to JavaScript. The document uses examples to demonstrate classes, interfaces, generics, and inheritance in TypeScript.
Angular & RXJS: examples and use casesFabio Biondi
The document discusses using RxJS in Angular applications. It provides examples of using RxJS operators like interval, map, async pipe, filter, switchMap, exhaustMap, tap, scan, and reduce. Common use cases include handling events, making HTTP requests, managing application state, and manipulating data. RxJS can be used in components, directives, services, routing, forms, and more throughout an Angular application.
This document discusses concurrency utilities introduced in Java 8 including parallel tasks, parallel streams, parallel array operations, CompletableFuture, ConcurrentHashMap, scalable updatable variables, and StampedLock. It provides examples and discusses when and how to properly use these utilities as well as potential performance issues. Resources for further reading on Java concurrency are also listed.
Reactive Programming on Android - RxAndroid - RxJavaAli Muzaffar
Introduction to RxJava for reactive programming and how to use RxAndroid to do reactive programming on Android.
There is a sample android app to go with the slides that has all the source shown in the project.
For most of us, Reactive Android means using RxJava. In this presentation, I try to borrow a few ideas from the backend world and enrich the concept of Reactive in Android.
This document provides an overview and agenda for a presentation on Angular for Java developers. The presentation will cover: generating an Angular project with Angular CLI; creating a Java REST service with Spring Boot; building an Angular REST client to interact with the Spring Boot backend; and demonstrating a sample Angular app using REST and WebSockets. It also briefly outlines key Angular concepts like components, dependency injection, routing, reactive programming with Observables, and forms.
This document provides an overview of Angular 2 for Java developers. It discusses that Angular 2 is a complete rewrite of AngularJS with a focus on components, better performance, and streamlined dependency injection. It also covers key aspects of Angular 2 like project structure, templates, data binding, dependency injection, routing, and use of reactive programming with RxJS. Sample code examples are provided to demonstrate concepts like components, services, dependency injection, routing, and use of observables.
Learn all the essentials of building Angular 2 applications right here.
https://www.udemy.com/angular-2-training/?couponCode=UANGULAR2
This is a beginner level course aimed at those new to Angular 2 and Typescript. No previous knowledge of either is required before starting this course.
This course combines slides, projects and quizzes in a clear, concise and engaging way to guide you through the core concepts of Angular 2 and Typescript.
You will gain a solid foundation for building real-world applications following best practices and the Angular 2 style guide. This includes how to build components, create shared services, navigate between views, manage data, and managing user and system events.
Building Universal Applications with Angular 2Minko Gechev
Angular is one of the most popular frameworks for the development of Single-Page Applications (SPA). Recently Google announced its second major version, which brings some brand new ideas and improvements. For instance, Angular 2 is written in TypeScript, has much faster change detection and allows development of universal (isomorphic) applications.
In this talk we're going to introduce the motivation behind the new design decisions and the improvements in Angular 2. We'll take a look at the building blocks the framework provides for the development of professional single-page applications.
Integrating consumers IoT devices into Business WorkflowYakov Fain
From the software development perspective IoT is about programming "things", connecting them with each other and integrating them with existing applications. This presentation will demonstrate how IoT-enabled devices from multiple manufacturers can be integrated into a workflow of a business application. You'll see a live demo of using commercial consumer devices as a part of an application that utilizes such technologies such as REST API, OAuth, Websockets, and Java. This presentation will give you an idea of how to go about integration of new devices as they become available on the market.
This document discusses data flow patterns in Angular 2. It begins by explaining the component tree structure and how components communicate with inputs and outputs. It then covers RxJS observables and operators for reactive programming. Observables can be used as inputs to components and with the async pipe. Forms and HTTP requests also return observables. Change detection strategies like OnPush can improve performance. Immutable data structures help avoid unnecessary checks. Overall, Angular 2 provides many options for component communication through RxJS observables and efficient change detection.
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...Baruch Sadogursky
A private Java (Maven or Gradle) repository as a service can be setup in the cloud. A private Docker registry as a service can be easily setup in the cloud. But what if you want to build a holistic CI/CD pipeline, and on the cloud of YOUR choice?
In this talk Baruch will take you through steps of setting up a universal artifact repository, which can serve for both Java and Docker. You’ll learn how to build a CI/CD pipeline with traceable metadata from the Java source files all the way to Docker images. Amazon, Azure, and Google Cloud (do you have setup that works on these?) will be used as an example although the recipes shown would be applicable to other cloud as well.
What is the difference between Angular 1 and Angular 2.
Content:
Where Angular 1.x is going?
Angular 2 - motivations and themes
Open-source culture in Angular team
Angular is a platform for building mobile and desktop web applications. It is no longer just a framework. Angular 2 offers improvements such as faster performance, modularity, support for modern browsers, and reactive programming using RxJS. Key parts of Angular include templates, directives, data binding, components, services, modules, and dependency injection. Features like Ahead-of-Time compilation and services improve app performance and reusability. TypeScript adds benefits like static typing and class-based programming.
AngularJS 1.3 is by far the best version of Angular available today. It was just released a few weeks ago. It's chock full of bug fixes, feature enhancements and performance improvements.
YouTube link: - https://youtu.be/bghVyCbxj6g
This presentation is dedicated to studying the fundamentals of Angular 2.
To follow along with the presentation, watch this 3-part YouTube Series here: http://bit.ly/2mnLZNz
You can also download Traversy's Spotify App here: http://bit.ly/2m1TxI3
Reactive Stream Processing Using DDS and RxSumant Tambe
In this presentation you will see why Reactive Extensions (Rx) is a powerful technology for asynchronous stream processing. RTI Data Distribution Service (DDS) will be used as the source of data and as a communication channel for asynchronous data streams. On top of DDS, we'll use Rx to subscribe, observe, project, filter, aggregate, merge, zip, and correlate one or more data streams (Observables). The live demo will be very visual as bouncing shapes of different colors will be transformed in front of you using C# lambdas, Rx.NET, and Visual Studio. You will also learn about the new Rx4DDS.NET library that integrates RTI DDS with Rx.NET. Rx and DDS are a great match because both are reactive. Rx is based on the subject-observer pattern, which is quite analogous to the publish-subscribe pattern of DDS. When used together they support distributed dataflows seamlessly. If time permits, we will touch upon advanced Rx concepts such as stream of streams (IGroupedObservable) and how it captures DDS "keyed topics". The DDS applications using Rx4DDS.NET dramatically simplify concurrency to the extent that it can be simply configured.
These are the presentation slides demonstratingseven versions of the UI of same HTML5 application using various libraries and frameworks. This application is described in detail in the O'Reilly book "Enterprise Web Development"
Dart is a productive way to develop future JavaScript apps today. It comes with a complete set of development tools and will help ease development of EcmaScript 6 in 2016. Dart simplifies development by allowing optional variable types and single inheritance for classes. It supports concurrency without threads. Popular IDEs like IntelliJ, WebStorm, and Eclipse support Dart development. Code can run in the Dart VM for fast feedback or compile to JavaScript to run in browsers.
This document provides an overview of Angular 2 and its main building blocks including modules, components, templates, data binding, directives, services, and routing. It discusses how Angular 2 differs from Angular 1 and is more opinionated. It also provides code examples for setting up the main module, creating components and templates, using dependency injection for services, and making HTTP requests from services.
This document provides an introduction to the Oracle JET framework from the perspective of John Sim and Lauren Beatty of Fishbowl Solutions. It discusses what Oracle JET is, its key features and benefits including its modularity and use of popular JavaScript libraries. It also demonstrates how to get started with Oracle JET using the QuickStart template and Yeoman generator, and provides an example of building a simple JET application that integrates with the Oracle Cloud Documents REST API.
RxJS Operators - Real World Use Cases - AngularMixTracy Lee
If you want to learn about the most important operators you need to know, check out this deck.
I touch on ~20 most common operators that you need in your arsenal, when you should be using them, and when you should not.
RxJS in Angular 2
1. Quick overview of progress on RxJS Next (now RxJS 5)
2. Comparing Promises with Observables, and talking about why Observables are a better choice for Single Page Applications, like those written with Angular
3. Show the anatomy of an Observable
4. Talk about what Operators are
5. Show an example of reconnecting a multiplexed Web Socket using Observables in Angular 2.
Functional Reactive Programming (FRP): Working with RxJSOswald Campesato
Functional Reactive Programming (FRP) combines functional programming and reactive programming by treating asynchronous data streams as basic elements. FRP uses Observables to represent these streams, which emit values over time that can be composed together using operators like map and filter. Popular libraries for FRP include RxJS, which supports asynchronous and event-based programs by modeling push-based data streams with Observables. Operators allow transforming and combining Observable streams to build reactive applications.
The document provides an introduction to RxJS (Reactive Extensions for JavaScript), which is a reactive programming library for asynchronous operations. It discusses key RxJS concepts like Observables, operators, and functional reactive programming. It also provides examples of using RxJS to handle events asynchronously and processing streams of data.
RxJS Operators - Real World Use Cases (FULL VERSION)Tracy Lee
This document provides an overview and explanation of various RxJS operators for working with Observables, including:
- The map, filter, and scan operators for transforming streams of data. Map applies a function to each value, filter filters values, and scan applies a reducer function over time.
- Flattening operators like switchMap, concatMap, mergeMap, and exhaustMap for mapping Observables to other Observables.
- Error handling operators like catchError, retry, and retryWhen for catching and handling errors.
- Additional explanation of use cases and common mistakes for each operator discussed. The document is intended to explain these essential operators for real world reactive programming use.
Streaming all the things with akka streams Johan Andrén
This document provides an overview and introduction to Akka Streams and Reactive Streams. Some key points:
- Reactive Streams is a standard for asynchronous stream processing with non-blocking back pressure to prevent issues like out of memory errors.
- Akka Streams is a toolkit for building powerful concurrent and distributed applications simply using a Reactive Streams-compliant API. It includes sources, sinks, flows and other stages for stream processing.
- Examples show how to create simple stream graphs that process data asynchronously using Akka Streams APIs in both Java and Scala in just a few lines of code. More complex examples demonstrate features like parallelization.
- The community Alpakka
Realtime Statistics based on Apache Storm and RocketMQXin Wang
This document discusses using Apache Storm and RocketMQ for real-time statistics. It begins with an overview of the streaming ecosystem and components. It then describes challenges with stateful statistics and introduces Alien, an open-source middleware for handling stateful event counting. The document concludes with best practices for Storm performance and data hot points.
Here I discuss about reactive programming, observable, observer and difference between observable and promise.
Also discuss some of important operators like forkJoin, switchMap, from, deboucneTime, discardUntilChanged, mergeMap. I discuss some of observable creation function.
Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using Observable sequences. RxJava implements Rx for the Java VM. Key advantages include simplifying async operations, surfacing errors sooner, and reducing state bugs. The API has a large surface area, so the learning curve is steep. RxJava 2 is recommended over 1 due to better performance, lower memory usage, and other improvements. Observables push data to Observers via onNext, onError, onCompleted calls. Common operators like map, flatMap, filter transform and combine Observable streams. Multithreading uses Schedulers. Unit testing uses TestSubscriber to make assertions.
Reactive stream processing using Akka streams Johan Andrén
This document discusses Akka streams and Reactive Streams. It provides an example of creating an Akka streams application that exposes an HTTP service serving an infinite stream of numbers. The example demonstrates how Akka streams provides asynchronous stream processing with back pressure to prevent out of memory errors.
The document discusses reactive programming and reactive systems. It defines the three parts of the reactive spectrum as reactive (software showing responses to stimuli), reactive systems (frameworks like Akka and Vert.x), and reactive programming (programming models using streams/flows like RxJava). It discusses key aspects of reactive systems like asynchronous programming, back pressure in streams to handle varying workloads, and using reactive types like Singles, Maybes and Completables. The document advocates for building responsive distributed systems using these reactive principles and introduces Vert.x as a toolkit for building such systems.
Let'Swift 2019 컨퍼런스에서 RxSwift to Combine 이라고 발표한 자료입니다. 자료 내에 언급되는 코드 링크는 다음과 같습니다.
[BringMyOwnBeer]
• RxSwift/RxCocoa: https://github.com/fimuxd/BringMyOwnBeer-
• Combine/SwiftUI: https://github.com/fimuxd/BringMyOwnBeer-Combine
Mary Grygleski and myself, gave a very successful workshop to 51 attendees in NYC on April 15th - here is the updated presentation
https://www.linkedin.com/in/mary-grygleski/
https://www.linkedin.com/in/grant-steinfeld/
RxJS is a library for reactive programming that allows composing asynchronous and event-based programs using observable sequences. It provides the Observable type for pushing multiple values to observers over time asynchronously. Operators allow transforming and combining observables. Key types include Observable, Observer, Subject, BehaviorSubject, and ReplaySubject. Subjects can multicast values to multiple observers. Overall, RxJS is useful for handling asynchronous events as collections in a declarative way.
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwiftAaron Douglas
This is an introduction to reactive concepts using Swift specifically with ReactiveX’s implementation, RxSwift. ReactiveX is an API for asynchronous programming with observable streams originally implemented with .NET and LINQ. ReactiveX is a combination of the best ideas from the Observer pattern, the Iterator pattern, and functional programming.
You’ll learn about all the basic moving parts of RxSwift and why you want to use it in your application.
Original presented 23-Aug-2016 at 360iDev 2016 - Denver, CO.
This document summarizes the agenda and details of the Belfast Java User Group meeting on October 23rd, 2013. The meeting will include introductions to the Belfast JUG, an overview of what a JUG is and how to get involved. There will also be presentations on keynotes from JavaOne and 20+ new features in JEE7. Attendees are encouraged to contribute ideas and get involved in the leadership team.
Reactive streams processing using Akka StreamsJohan Andrén
This document provides a summary of a presentation about Akka streams. It discusses Reactive Streams, which is a standard for asynchronous stream processing with non-blocking back pressure. It provides examples of building stream processing graphs with Akka Streams in just a few lines of code to transform and process data from sources to sinks. It also gives a more complex example of processing sensor measurements from a web socket connection and writing the data to a database.
This document provides an overview of TypeScript for Java developers. It discusses what TypeScript is, its popularity according to surveys, how it adds types to JavaScript to catch errors, typical workflows using TypeScript and IDEs, classes and inheritance in TypeScript, generics and interfaces, and decorators. Examples are provided throughout to illustrate TypeScript concepts and features.
This document discusses WebSockets and their use in Angular applications. It contains the following information:
1. An introduction to WebSockets, including what they are, where server push is needed, and how to use them in plain JavaScript.
2. Two ways to use WebSockets in Angular - manually creating WebSocket objects or using RxJS WebSocketSubject.
3. A code example of a WebSocket service in Angular that wraps a WebSocket object and exposes it as an Observable stream.
Using JHipster for generating Angular/Spring Boot appsYakov Fain
1. The document discusses using JHipster, an open source tool, to generate Angular and Spring Boot applications. It demonstrates generating both monolithic and microservices applications.
2. Key features of JHipster covered include generating entities, internationalization, and deployment options. Running and developing applications in both development and production modes is explained.
3. Examples are provided of generating sample applications using JHipster's online generator and locally installed generator. This includes reviewing the generated code and application structure.
Using JHipster for generating Angular/Spring Boot appsYakov Fain
The document discusses using JHipster 4 for generating Angular and Spring Boot applications. It begins with an overview of Spring Boot and Angular and demonstrates generating a basic monolithic application with them. It then introduces JHipster as a tool for generating Angular/Spring Boot projects along with best practices. The rest of the document demonstrates features of JHipster like generating entities, internationalization, and microservices architecture.
This document introduces TypeScript for Java developers. It provides an overview of TypeScript, why to use it, how to get started, and examples of key TypeScript features like classes, interfaces, generics, decorators, and async/await. The author is an Angular practice lead and Java Champion who has authored books on Angular development with TypeScript. The document demonstrates how to set up a TypeScript environment and compile code, and provides code samples for many TypeScript language features and patterns.
Using JHipster 4 for generating Angular/Spring Boot appsYakov Fain
JHipster 4 is an open-source code generator that allows you to automate generation and configuration of the Web project that uses the latest version of Angular on the front and Spring framework on the back. Over the next year, Angular/Spring combination will become a valuable addition to the skill set of any enterprise Java developer. In this presentation, you’ll see how to jump-start a Web project with JHipster.
This document provides an overview of JavaScript concepts including:
- Where JavaScript can run including web browsers and JavaScript engines.
- Key differences from Java like JavaScript arriving as text with no compiler and need to work across runtime environments.
- Tools for debugging and developing JavaScript like Firefox's Firebug and Chrome Developer Tools.
- Variables, functions, objects, and inheritance in JavaScript compared to other languages like Java. Functions can be treated as first-class objects and assigned to properties or passed as callbacks.
This document describes how the author created and ran a virtual company with remote workers. It discusses how they started with an idea to create a consulting company, recruited remote developers primarily from Eastern Europe, and later spun off the consulting work into a product company. They were able to successfully run and grow both companies entirely remotely for many years without a central office by using flexible work arrangements, competitive pay, clear processes and communication.
The document introduces Git and GitHub for managing code repositories in a distributed version control system. It explains the basic Git concepts and workflows including initializing local repositories, staging and committing changes, and pushing/pulling from remote repositories hosted on services like GitHub. The document provides an overview of how distributed version control with Git differs from centralized systems and allows developers to work offline and sync changes later.
Surviving as a Professional Software DeveloperYakov Fain
This presentation was made in Kiev, Ukraine at JEEConf, May 2013 as a sequel to this one: http://www.slideshare.net/yfain/yakov-fain-enterprisedeveloperkiev.
Session 1 - Intro to Robotic Process Automation.pdfUiPathCommunity
👉 Check out our full 'Africa Series - Automation Student Developers (EN)' page to register for the full program:
https://bit.ly/Automation_Student_Kickstart
In this session, we shall introduce you to the world of automation, the UiPath Platform, and guide you on how to install and setup UiPath Studio on your Windows PC.
📕 Detailed agenda:
What is RPA? Benefits of RPA?
RPA Applications
The UiPath End-to-End Automation Platform
UiPath Studio CE Installation and Setup
💻 Extra training through UiPath Academy:
Introduction to Automation
UiPath Business Automation Platform
Explore automation development with UiPath Studio
👉 Register here for our upcoming Session 2 on June 20: Introduction to UiPath Studio Fundamentals: https://community.uipath.com/events/details/uipath-lagos-presents-session-2-introduction-to-uipath-studio-fundamentals/
AppSec PNW: Android and iOS Application Security with MobSFAjin Abraham
Mobile Security Framework - MobSF is a free and open source automated mobile application security testing environment designed to help security engineers, researchers, developers, and penetration testers to identify security vulnerabilities, malicious behaviours and privacy concerns in mobile applications using static and dynamic analysis. It supports all the popular mobile application binaries and source code formats built for Android and iOS devices. In addition to automated security assessment, it also offers an interactive testing environment to build and execute scenario based test/fuzz cases against the application.
This talk covers:
Using MobSF for static analysis of mobile applications.
Interactive dynamic security assessment of Android and iOS applications.
Solving Mobile app CTF challenges.
Reverse engineering and runtime analysis of Mobile malware.
How to shift left and integrate MobSF/mobsfscan SAST and DAST in your build pipeline.
How information systems are built or acquired puts information, which is what they should be about, in a secondary place. Our language adapted accordingly, and we no longer talk about information systems but applications. Applications evolved in a way to break data into diverse fragments, tightly coupled with applications and expensive to integrate. The result is technical debt, which is re-paid by taking even bigger "loans", resulting in an ever-increasing technical debt. Software engineering and procurement practices work in sync with market forces to maintain this trend. This talk demonstrates how natural this situation is. The question is: can something be done to reverse the trend?
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyScyllaDB
Freshworks creates AI-boosted business software that helps employees work more efficiently and effectively. Managing data across multiple RDBMS and NoSQL databases was already a challenge at their current scale. To prepare for 10X growth, they knew it was time to rethink their database strategy. Learn how they architected a solution that would simplify scaling while keeping costs under control.
Taking AI to the Next Level in Manufacturing.pdfssuserfac0301
Read Taking AI to the Next Level in Manufacturing to gain insights on AI adoption in the manufacturing industry, such as:
1. How quickly AI is being implemented in manufacturing.
2. Which barriers stand in the way of AI adoption.
3. How data quality and governance form the backbone of AI.
4. Organizational processes and structures that may inhibit effective AI adoption.
6. Ideas and approaches to help build your organization's AI strategy.
Skybuffer SAM4U tool for SAP license adoptionTatiana Kojar
Manage and optimize your license adoption and consumption with SAM4U, an SAP free customer software asset management tool.
SAM4U, an SAP complimentary software asset management tool for customers, delivers a detailed and well-structured overview of license inventory and usage with a user-friendly interface. We offer a hosted, cost-effective, and performance-optimized SAM4U setup in the Skybuffer Cloud environment. You retain ownership of the system and data, while we manage the ABAP 7.58 infrastructure, ensuring fixed Total Cost of Ownership (TCO) and exceptional services through the SAP Fiori interface.
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...DanBrown980551
This LF Energy webinar took place June 20, 2024. It featured:
-Alex Thornton, LF Energy
-Hallie Cramer, Google
-Daniel Roesler, UtilityAPI
-Henry Richardson, WattTime
In response to the urgency and scale required to effectively address climate change, open source solutions offer significant potential for driving innovation and progress. Currently, there is a growing demand for standardization and interoperability in energy data and modeling. Open source standards and specifications within the energy sector can also alleviate challenges associated with data fragmentation, transparency, and accessibility. At the same time, it is crucial to consider privacy and security concerns throughout the development of open source platforms.
This webinar will delve into the motivations behind establishing LF Energy’s Carbon Data Specification Consortium. It will provide an overview of the draft specifications and the ongoing progress made by the respective working groups.
Three primary specifications will be discussed:
-Discovery and client registration, emphasizing transparent processes and secure and private access
-Customer data, centering around customer tariffs, bills, energy usage, and full consumption disclosure
-Power systems data, focusing on grid data, inclusive of transmission and distribution networks, generation, intergrid power flows, and market settlement data
What is an RPA CoE? Session 1 – CoE VisionDianaGray10
In the first session, we will review the organization's vision and how this has an impact on the COE Structure.
Topics covered:
• The role of a steering committee
• How do the organization’s priorities determine CoE Structure?
Speaker:
Chris Bolin, Senior Intelligent Automation Architect Anika Systems
Have you ever been confused by the myriad of choices offered by AWS for hosting a website or an API?
Lambda, Elastic Beanstalk, Lightsail, Amplify, S3 (and more!) can each host websites + APIs. But which one should we choose?
Which one is cheapest? Which one is fastest? Which one will scale to meet our needs?
Join me in this session as we dive into each AWS hosting service to determine which one is best for your scenario and explain why!
"Scaling RAG Applications to serve millions of users", Kevin GoedeckeFwdays
How we managed to grow and scale a RAG application from zero to thousands of users in 7 months. Lessons from technical challenges around managing high load for LLMs, RAGs and Vector databases.
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...Fwdays
Direct losses from downtime in 1 minute = $5-$10 thousand dollars. Reputation is priceless.
As part of the talk, we will consider the architectural strategies necessary for the development of highly loaded fintech solutions. We will focus on using queues and streaming to efficiently work and manage large amounts of data in real-time and to minimize latency.
We will focus special attention on the architectural patterns used in the design of the fintech system, microservices and event-driven architecture, which ensure scalability, fault tolerance, and consistency of the entire system.
High performance Serverless Java on AWS- GoTo Amsterdam 2024Vadym Kazulkin
Java is for many years one of the most popular programming languages, but it used to have hard times in the Serverless community. Java is known for its high cold start times and high memory footprint, comparing to other programming languages like Node.js and Python. In this talk I'll look at the general best practices and techniques we can use to decrease memory consumption, cold start times for Java Serverless development on AWS including GraalVM (Native Image) and AWS own offering SnapStart based on Firecracker microVM snapshot and restore and CRaC (Coordinated Restore at Checkpoint) runtime hooks. I'll also provide a lot of benchmarking on Lambda functions trying out various deployment package sizes, Lambda memory settings, Java compilation options and HTTP (a)synchronous clients and measure their impact on cold and warm start times.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/temporal-event-neural-networks-a-more-efficient-alternative-to-the-transformer-a-presentation-from-brainchip/
Chris Jones, Director of Product Management at BrainChip , presents the “Temporal Event Neural Networks: A More Efficient Alternative to the Transformer” tutorial at the May 2024 Embedded Vision Summit.
The expansion of AI services necessitates enhanced computational capabilities on edge devices. Temporal Event Neural Networks (TENNs), developed by BrainChip, represent a novel and highly efficient state-space network. TENNs demonstrate exceptional proficiency in handling multi-dimensional streaming data, facilitating advancements in object detection, action recognition, speech enhancement and language model/sequence generation. Through the utilization of polynomial-based continuous convolutions, TENNs streamline models, expedite training processes and significantly diminish memory requirements, achieving notable reductions of up to 50x in parameters and 5,000x in energy consumption compared to prevailing methodologies like transformers.
Integration with BrainChip’s Akida neuromorphic hardware IP further enhances TENNs’ capabilities, enabling the realization of highly capable, portable and passively cooled edge devices. This presentation delves into the technical innovations underlying TENNs, presents real-world benchmarks, and elucidates how this cutting-edge approach is positioned to revolutionize edge AI across diverse applications.
Fueling AI with Great Data with Airbyte WebinarZilliz
This talk will focus on how to collect data from a variety of sources, leveraging this data for RAG and other GenAI use cases, and finally charting your course to productionalization.
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving
Manufacturing custom quality metal nameplates and badges involves several standard operations. Processes include sheet prep, lithography, screening, coating, punch press and inspection. All decoration is completed in the flat sheet with adhesive and tooling operations following. The possibilities for creating unique durable nameplates are endless. How will you create your brand identity? We can help!
5. Main RxJS players
• Observable - a producer of sequences of values
• Observer - a consumer of observable values
• Subscriber - connects observer with observable
• Operator - en-route value transformation
11. An Observable allows:
• Subscribe/unsubscribe to its data stream
• Emit the next value to the observer
• Notify the observer about errors
• Inform the observer about the stream completion
12. An Observer provides:
• A function to handle the next value from the stream
• A function to handle errors
• A function to handle end-of-stream
13. Creating an Observable
• Observable.create() - returns Observable that can invoke methods on Observer
• Observable.from() - converts an array or iterable into Observable
• Observable.fromEvent() - converts an event into Observable
• Observable.fromPromise() - converts a Promise into Observable
• Observable.range() - returns a sequence of integers in the specified range
26. Error-handling operators
• error() is invoked by the Observable on the Observer.
• catch() - intercepts the error in the subscriber before the observer gets it. You can
handle the error and re-subscribe.
• retry(n) - retry immediately up to n times
• retryWhen(fn) - retries as prescribed by the argument
27. // Declaring
function getData(): Observable {…} // data source 1
function getCachedData(): Observable {…} // data source 2
function getDataFromAnotherService(): Observable {…} // data source 3
//Invoking and subscribing
getData()
.catch(err => {
if (err.status === 500){
console.error("Switching to streaming cached beer data");
return getCachedData();
} else{
console.error("Switching to another beer service");
return getDataFromAnotherService();
}
})
.map(beer => beer.name + ", " + beer.country)
.subscribe(
beer => console.log("Subscriber got " + beer)
);
F
a
i
l
o
v
e
r
Failover with catch()
plunker: http://bit.ly/2jXY9ha
31. Operator concat
Subscribe to the next observable only when the previous completes. It’s
useful for a sequential processing, e.g. HTTP requests.
// Emulate HTTP requests
let fourSecHTTPRequest = Rx.Observable.timer(4000).mapTo('First response');
let oneSecHTTPRequest = Rx.Observable.timer(1000).mapTo('Second response');
Rx.Observable
.concat(fourSecHTTPRequest, oneSecHTTPRequest)
.subscribe(res => console.log(res));
plunker http://bit.ly/2keEoiI
35. An input field: FormControl
• valueChanges - the value of the form control changes
this.searchInput.valueChanges.subscribe(…);
• statusChanges - status of the form control (valid/invalid)
this.password.statusChanges.subscribe(…);
36. Observable Events in Angular forms
@Component({
selector: "app",
template: `
<h2>Observable events demo</h2>
<input type="text" placeholder="Enter stock" [formControl]="searchInput">
`
})
class AppComponent {
searchInput: FormControl;
constructor(){
this.searchInput = new FormControl('');
this.searchInput.valueChanges
.debounceTime(500)
.subscribe(stock => this.getStockQuoteFromServer(stock));
}
getStockQuoteFromServer(stock) {
console.log(`The price of ${stock} is ${100*Math.random().toFixed(4)}`);
}
}
Observable
38. Http and Observables
class AppComponent {
products: Array<string> = [];
constructor(private http: Http) {
this.http.get(‘/products')
.map(res => res.json())
.subscribe(
data => {
this.products=data;
},
err =>
console.log("Can't get products. Error code: %s, URL: %s ",
err.status, err.url),
() => console.log('Product(s) are retrieved')
);
}
}
O
b
s
e
r
v
e
r
40. The switchMap operator
RxJS 5, official doc:
http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-
switchMap
Returns an Observable that emits items based on
applying a function that you supply to each item emitted
by the source Observable, where that function returns
an (so-called "inner") Observable. Each time it observes
one of these inner Observables, the output Observable
begins emitting the items emitted by that inner
Observable. When a new inner Observable is emitted,
switchMap stops emitting items from the earlier-emitted
inner Observable and begins emitting items from the
new one. It continues to behave like this for subsequent
inner Observables.
41. The switchMap operator
RxJS 5, official doc:
http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-
switchMap
Returns an Observable that emits items based on
applying a function that you supply to each item emitted
by the source Observable, where that function returns
an (so-called "inner") Observable. Each time it observes
one of these inner Observables, the output Observable
begins emitting the items emitted by that inner
Observable. When a new inner Observable is emitted,
switchMap stops emitting items from the earlier-emitted
inner Observable and begins emitting items from the
new one. It continues to behave like this for subsequent
inner Observables.
42. When a picture worth a thousand words
http://reactivex.io/documentation/operators/images/switchMap.png
43. The switchMap operator in English
• An outer observable emits the data and switches over to the inner
observable for processing
• If the outer observable emits the new data while the inner one is still
processing, the inner observable is terminated
• The inner observable starts processing the newly emitted data
• Example: A user types in a field (outer observable) and the HTTP
requests are being made (inner observable) as the user types
47. Receiving params in ActivatedRoute
• Inject ActivatedRoute into a component to receive
route params during navigation
• Use ActivatedRoute.snapshot to get params once
• Use ActivatedRoute.param.subscribe() for
receiving multiple params over time
48. Subject: Observable + Observer
Can emit values and allows to subscribe to them
@Component({
selector: "app-root",
template: `
<h3>Using Subject for emitting/subscribing to keyup and input events</h3>
<input type="text" placeholder="Start typing"
(input)="mySubject.next($event)" (keyup)="myKeySubject.next($event)">
`
})
export class AppComponent {
mySubject: Observable<Event> = new Subject(); // Observable for any events
myKeySubject: Observable<KeyboardEvent> = new Subject(); // Observable for keyboard events
constructor(){
this.myKeySubject.subscribe(({type, key}) => console.log(`Event: ${type} key: ${key}`));
this.mySubject.subscribe(({type, target}) => console.log(
`Event: ${type} value: ${(<HTMLInputElement>target).value}`));
}
}
49. Sharing an Observable
@Component({
selector: "app-root",
template: `
<h3>Sharing Observable between subscribers to keyup and input events</h3>
<input type="text" placeholder="Start typing"
(input)="mySubject.next($event)"
(keyup)="mySubject.next($event)">
<br> Subscriber to input events got {{inputValue}}
<p>
<br> Subscriber to input events got {{keyValue}}
`
})
export class AppComponent {
keyValue: string;
inputValue: string;
mySubject: Observable<Event> = new Subject().share(); // Single Observable for any events
constructor(){
// Subscriber 1
this.mySubject
.filter(({type}) => type==="keyup")
.map(e => (<KeyboardEvent>e).key)
.subscribe((value) => this.keyValue=value);
// Subscriber 2
this.mySubject
.filter(({type}) => type==="input")
.map(e => (<HTMLInputElement>e.target).value)
.subscribe((value) => this.inputValue=value);
}
}
50. @Component({
selector: "app",
template: `
<h2>Sharing the same stream</h2>
<input #myinput type="text" placeholder="Start typing" >
<br> Subscribing to each value: {{data1}}
<br> Subscribing to 3-second samples: {{data2}}
`})
class AppComponent {
@ViewChild('myinput') myInputField: ElementRef;
data1: string;
data2: string;
ngAfterViewInit(){
let keyup$: Observable = Observable.fromEvent(this.myInputField.nativeElement, 'keyup');
let keyupValue$ = keyup$
.map(event => event.target.value)
.share();
// Subscribe to each keyup
keyupValue$
.subscribe(value => this.data1 = value);
// Subscribe to 3-second samples
keyupValue$
.sample(Observable.interval(3000))
.subscribe(value => this.data2 = value);
}
}
Accessing native elements with ElementRef
Using ElementRef
is not recommended
52. Subscribing to EventEmitter
export declare class EventEmitter<T> extends Subject<T> {}
myEvent: EventEmitter<string> = new EventEmitter();
myEvent.emit("Hello World");
…
myEvent.subscribe(event => console.log(" Received " + event);
Your app:
Angular:
Has Observer
and Observable
54. Subscribing to EventEmitter
export declare class EventEmitter<T> extends Subject<T> {}
myEvent: EventEmitter<string> = new EventEmitter();
myEvent.emit("Hello World");
…
myEvent.subscribe(event => console.log(" Received " + event);
Your app:
Angular:
55. Mediator, DI, Events, and Observables
StateService
Component1
with injected
StateService
Component2
with injected
StateService
EventEmitter
Emit event
on StateService
Subscribe to event
of StateService
61. Summary
• Everything is an observable
• No data is pushed to you until you subscribe
• Chain the operators to pre-process the observable data before it gets
to the subscriber
• Angular offers you ready-to-use observables in multiple components
and services
• You can wrap the data pushed to your app into an Observable
62. Thank you!
• Code samples:
https://github.com/yfain/observables
• Training inquiries:
training@faratasystems.com
• My blog:
yakovfain.com
• Twitter: @yfain