Skip to content

loxon-lab/reactive-programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reactive programming

Why(?) is this good for us?

This repository contains the source files about Reactive programming meetup. We talked about what is the reactive programming, why to use it, and how can we use it in Node, and Java world.

Presentation

https://docs.google.com/presentation/d/1GsbnSRerh7ICy8e9MqzhDS2IQIYumDK452zUKBAVRgQ/edit?usp=sharing

Folder Structure

  • reactivity-node: Node implementation of the reactive programming
  • reactivity-spring: Spring implementation of the reactive programming, and non reactive programming
  • test: Performance tests

Application

Our application (in every implementation) is a simple calculation application. The calculation instructions comes from the joson, and send it in HTTP REST protocol.

Sample request

[
    {
        "operation": "MULTIPLY",
        "leftValue": 1,
        "rightValue": 2,
        "leftOperation": null,
        "rightOperation": null
    }
]

Available operations: ADD MULTIPLY, READFILE, READDB, PI

How to generate request json

Start spring application and call:

ELEMENT_NUM=5000 && wget "http://localhost:8080/api/generate?num=${ELEMENT_NUM}&min=30&max=1000" -O request.json

How to run Node application

Prerequisite

  • Docker-ce

Build & Run

cd reactivity-node 
./1-create-new-image.sh
./2-start-ecosystem.sh

URL

curl -X POST http://localhost:3000/calculate -d @request.json --header "Content-Type: application/json"

How to run Spring application

Prerequisite

  • Docker-ce
  • JDK8

Build & Run

cd reactivity-spring
./1-create-new-image.sh
./2-start-ecosystem.sh

URL

# Webflux
curl -X POST http://localhost:8080/api/calculate -d @request.json --header "Content-Type: application/json" 

# Parralel stream
curl -X POST http://localhost:8080/api/calculate/sync -d @request.json --header "Content-Type: application/json" 

# Stream
curl -X POST http://localhost:8080/api/calculate/sync?type=STREAM -d @request.json --header "Content-Type: application/json" 

# Foreach
curl -X POST http://localhost:8080/api/calculate/sync?type=FOREACH -d @request.json --header "Content-Type: application/json" 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published