Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

ReactiveLab

Experiments and prototypes with reactive application design.

Subscribe to updates I use ReactiveLab


Statistics on ReactiveLab

Number of watchers on Github 185
Number of open issues 6
Main language Java
Average time to merge a PR about 13 hours
Open pull requests 5+
Closed pull requests 1+
Last commit over 2 years ago
Repo Created over 5 years ago
Repo Last Updated over 1 year ago
Size 581 KB
Organization / Authornetflix
Latest ReleaseReact2014-SanFrancisco
Contributors8
Page Updated
Do you use ReactiveLab? Leave a review!
View open issues (6)
View ReactiveLab activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating ReactiveLab for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

ReactiveLab

Experiments and prototypes with reactive application design using service-oriented architecture concepts.

Discovery

Start discovery server using StartEurekaServer.java

./gradlew startDiscovery

Gateway

Start gateway server using StartGatewayServer.java or Gradle:

./gradlew startGateway

Services

Simulation of middle-tier RPC/RESTful services exposing endpoints over HTTP.

Start several services on different ports using StartMiddleTierServices.java or Gradle:

./gradlew startServices

Server

See how Netty and RxJava are used as an HTTP server in GatewayServer

Basics are:

        RxNetty.createHttpServer(8080, (request, response) -> {
            System.out.println("Server => Request: " + request.getPath());
            ... handle requests here ...
        }).startAndWait();

Client

Clients using Netty and RxJava can be seen in the clients package.

Basic example:

        return RxNetty.createHttpClient("localhost", 9100)
                .submit(HttpClientRequest.createGet("/mock.json?id=" + id));

Hystrix

Here is a batch request using SSE inside a HystrixObservableCommand for fault-tolerance: BookmarksCommand.

A HystrixObservableCollapser can be put in front of that command to allow automated batching: BookmarkCommand.

Composition

Nested, parallel execution of network requests can be composed using RxJava and Hystrix as demonstrated in RouteForDeviceHome which is the example running at the /device/home endpoint.

Here is a portion of the code to show the composition:

        return new UserCommand(userId).observe().flatMap(user -> {
            Observable<Map<String, Object>> catalog = new PersonalizedCatalogCommand(user).observe()
                    .flatMap(catalogList -> {
                        return catalogList.videos().<Map<String, Object>> flatMap(video -> {
                            Observable<Bookmark> bookmark = new BookmarkCommand(video).observe();
                            Observable<Rating> rating = new RatingsCommand(video).observe();
                            Observable<VideoMetadata> metadata = new VideoMetadataCommand(video).observe();
                            return Observable.zip(bookmark, rating, metadata, (b, r, m) -> {
                                return combineVideoData(video, b, r, m);
                            });
                        });
                    });

            Observable<Map<String, Object>> social = new SocialCommand(user).observe().map(s -> {
                return s.getDataAsMap();
            });

            return Observable.merge(catalog, social);
        }).flatMap(data -> {
            return response.writeAndFlush(new ServerSentEvent("", "data", SimpleJson.mapToJson(data)), EdgeServer.SSE_TRANSFORMER);
        });

This results in 7 network calls being made, and multiple bookmark requests are automatically collapsed into 1 network call. Here is the HystrixRequestLog that results from the code above being executed:

Server => Hystrix Log [/device/home] => UserCommand[SUCCESS][191ms], PersonalizedCatalogCommand[SUCCESS][50ms], SocialCommand[SUCCESS][53ms], RatingsCommand[SUCCESS][65ms]x6, VideoMetadataCommand[SUCCESS][73ms]x6, BookmarksCommand[SUCCESS, COLLAPSED][25ms], BookmarksCommand[SUCCESS, COLLAPSED][24ms]
ReactiveLab open issues Ask a question     (View All Issues)
  • over 4 years Some questions
ReactiveLab open pull requests (View All Pulls)
  • Fix link title
  • Fixes for README
  • Switch to new netflixoss build and gradle 2.2.1
  • Update README.md
  • tiny readme on which calls may be done
ReactiveLab list of languages used
ReactiveLab latest release notes
React2014-SanFrancisco React 2014 - San Francisco

Tag representing code used at React 2014 San Francisco workshop.

React2014-London React 2014 - London

Tag representing code used at React 2014 London workshop.

Other projects in Java