Git Product home page Git Product logo

apm287's Introduction

APM-287 Reactive programming

Starting

The app consists of two parts: backend containing different reactive and non-reactive service implementations and mobile frontend for using the exposed rest services.

Backend

Backend is a Spring Boot application and can be started by running:

apm287-stock-backend$ ./gradle bootRun

The properties of the application is defined in the application.properties and there it's possible to:

  • select type of service implementation (akka, java-sync, java-concurrent, etc)
  • define properties of the ApprovalService that can serve as bottle-neck in the app

Available REST points are:

When started application can be remotely debugged on port 9080.

Mobile

For mobile / web front end to start you need to install NodeJS on your machine. Then use npm command to install the following:

npm install ionic cordova -g
npm install chart.js --save

Then the app can be served with:

apm287-stock-mobile$ ionic serve

and accessible on http://localhost:8100.

Implement new service

If you wish to implement a new stock service and try out new library please implement the IStockService interface. Interface methods return Java Object as result so you can return anything you wish if this is allowed as result by Spring Rest. Thus, you can return DTO objects, but also Future, CompletableFuture, etc.

The general requirements are:

  • There are at least 5 stocks
  • Stocks are updated every second (by an external thread, executor, message)
  • Stocks can be bought and sold with the current price
  • Starting balance is 10,000 and can be used for buying stocks
  • When buying more than 5 stocks, ApprovalService must be called to authorize the transaction
  • You can only buy stocks if enough balance to pay them
  • You can only sell stocks if you own them

To better understand the general requirements check de.novatec.apm287.java.sync.StockManager which implements requirements in plan Java using synchronized methods.

Once new service is implemented, please add the option to use in the de.novatec.apm287.Apm287Application and change the application.properties to use the new implementation.

Load testing

Gatling load test is located under gatling/ folder. It can be used to generate considerable load on the backend. Please note that used service implementation and ApprovalService settings heavily affect the load test results.

apm287's People

Watchers

 avatar

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.