Reactive Programming in Java: How, Why, and Is It Worth Doing? Data flow
Data flow and reactive programming. Check it out.
Other articles
How to do Indexing in MongoDB with Elastic Search? Part 2
How to do Indexing in MongoDB with Elastic Search? Part 1
How to store data on browser using NoSQL IndexedDB?
How to Apply MBTI in HR: Motivation for every day. Groups of People & their Motivations
Check out our new courses
How to query time increase in Impala?
How to Apply MBTI in HR: Motivation for every day
Object-relational Mapping Using JPA, Hibernate and Spring Data JPA. Comparing the performance of persisting entities
How to implement Matrix Multiplication using Map-Reduce?
Object-relational Mapping Using JPA, Hibernate and Spring Data JPA. Comparing the approaches of persisting entities
Data Flow
A standard application job is to read, process, and write data. If we want to make these operations asynchronous, we should use asynchronous reading, processing, and writing.
For example, if an asynchronous function is blocked, we write excellent code:
readData.get() and blocked,
processData.get() and blocked,
writeData.get() and blocked immediately.
And we get synchronous code at the output. It’s not asynchronous and not easy to use.
Let’s look at a typical task where we have asynchronous data reading and then want to process data in three threads:
We don't need many threads to wait for the results of the reading. We just want to get data. This data should be processed, and processing is a resource-consuming task in terms of CPU, and it would be good to parallelize it. We say: “Read data. Once you do it, process them in three threads, then combine the results of execution and write data.” And we would like to do this as asynchronous operations.
The original article can be found here.
Interested in learning how to program with Java or in upgrading your Java programming skills? Check out our trainings.