Simplereact: Java 8-based simple FRP Fluent API

Source: Internet
Author: User

Simplereact is a small, concurrency-enabled library package from AOL, built directly on the Java 8-based completablefuture, JDK function interface, and streams API, and its fluent API provides a solution to 90% Reactive usage scenarios, it is important not to bring in any complexity. Can implement functional reactive programming paradigm (for short: FRP, functional response programming)

With Simplereact, you can easily extend microservices, which can be used to manage remote calls to microservices and to meet the requirements of high-concurrency large-scale high-performance platforms.

Use Simplereact to build non-clogging microservices and rest clients.

Simplereact starts in the supplier array, which primarily produces data that other functions need to respond to, and each supplier is passed to executor execution in a separate thread execution mode.

List<completablefuture<integer>> futures = new simplereact () .<integer> react ((), 1, () , 2, (), 3). With (IT--it * 100);

In this case, 3 supplier produce three numbers, which can be executed in parallel, when they complete each number multiplied by 100, which is also performed as a parallel separate task (by Forkjoinpool or a configurable task executor), simple React will immediately return to the list of future object collections, which will also execute asynchronously without any clogging.

New Simplereact () .<integer> react ((), 1, (), 2, (), 3). Then (IT-it * 100 ). Then (it, "*" + IT)


React then allows event reactor to be concatenated, unlike "React with", returning only a future collection, React then is a fluent interface, capable of returning React builder, Allow subsequent reactor to be added to the series chain, React then will not clog, React with can be called after React then, as long as React then provide access to the full completeablefuture API, Completeablefuture can be passed back to Simplereact via Simplereact.react (streamofcompleteablefutures).

More complex application cases visible

Project: Aol/simple-react GitHub



Simplereact: Java 8-based simple FRP Fluent API

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.