GithubHelp home page GithubHelp logo

asarkar / akka Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 2.45 MB

My Akka and Akka Streams projects

License: GNU General Public License v3.0

Scala 94.49% Java 0.12% Shell 4.85% Batchfile 0.54%

akka's People

Contributors

asarkar avatar

Watchers

 avatar  avatar

akka's Issues

Make a movie-db Java project

For comparison and learning purposes, we should have a Java version of movie-db. We can use Spring 5 Functional Web framework. Spring Data Mongo Reactive can use used for reactive DB access and org.springframework.web.reactive.function.client.WebClient for reactive HTTP calls. This project does it all. Project Reactor is a fine choice for reactive implementation: This SO thread has an example of splitting a stream using project Reactor which for completeness is copied below:

@Test
public void partitioning() throws InterruptedException {
    final int N = 10;
    Flux<Integer> source = Flux.range(1, 10000).share();
    // partition source into publishers
    Publisher<Integer>[] publishers = new Publisher[N];
    for (int i = 0; i < N; i++) {
        final int idx = i;
        publishers[idx] = source.filter(v -> v % N == idx);
    }
    // create ParallelFlux each 'rail' containing single partition
    ParallelFlux.from(publishers)
            // schedule partitions into different threads
            .runOn(Schedulers.newParallel("proc", N))
            // process each partition in its own thread, i.e. in order
            .map(it -> {
                String threadName = Thread.currentThread().getName();
                Assert.assertEquals("proc-" + (it % 10 + 1), threadName);
                return it;
            })
            // collect results
            .sequential()
            .publishOn(Schedulers.newSingle("subscriber"))
            .subscribe(it -> {
                String threadName = Thread.currentThread().getName();
                Assert.assertEquals("subscriber-1", threadName);
            });
    Thread.sleep(1000);
}

This slideshare presentation shows how to make reactive Mongo calls without using Spring Data. Here is the code used in the presentation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.