Giter Site home page Giter Site logo

order-service's Introduction

Order Service

An assignment that implements fail-over mechanism using Apache Zookeeper.

Requirements

Config

Redis connection, key name and the number of items accounted for in the statistics services are configurable at /orderservice/src/main/resources/config.properties

Build

  • Build https://github.com/hunghoang/masterslave in order to have the required jar available in the local maven repository
  • Without tests: mvn clean install -DskipTests
  • With unit tests: mvn clean install (a Redis server with proper config is required)

Deployment

  • Start zookeeper on the local machine that listens on port 2181
  • Start redis as configured
  • Run mvn tomcat:run -Dmaven.tomcat.port=<port>

Without the -Dmaven.tomcat.port parameter, the web app will be binded to port 8080 by default

The web app is then available at http://localhost:<port>/orderservice/

  • Run several server instances at different ports simultaneously in order to test fail-over mechanism
  • /orderservice/test.html could be used to test POST order services

Services

Place Order

POST http://localhost:<port>/orderservice/api/order/placeOrder

POST parameters:

  • account: string
  • symbol: string
  • price: float
  • volume: integer
  • type: string
Replace Order

POST http://localhost:<port>/orderservice/api/order/replaceOrder

POST parameters:

  • id: string
  • account: string
  • symbol: string
  • price: float
  • volume: integer
  • type: string
Cancel Order

POST http://localhost:<port>/orderservice/api/order/cancelOrder

POST parameters:

  • id: string
  • account: string
  • symbol: string
  • price: float
  • volume: integer
  • type: string
Top-value Orders

GET http://localhost:<port>/orderservice/api/stats/topOrders

Accounts with top-value orders

GET http://localhost:<port>/orderservice/api/stats/topAccounts

order-service's People

Contributors

trungv0 avatar

Watchers

 avatar  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.