Code Monkey home page Code Monkey logo

transaction_statistic_streaming_service's Introduction

Project : Transaction stats streaming as a service

Code provide streaming of real time stats of transactions as a service and provide the instructions to deploy the code in docker container.

Project Brief

This service has two end points, first one to get the transaction data into the system and second endpoint provide the way to get the stats(sum,total,min,max,avg) of transactions whose time stamp is not older than 60 seconds. In order to acheive the time and space complexity almost constant for /statistic end point , a daemon kind of scheduled process has been setup. This process execute with 1 millisecond of interval of its last iteration , that make sure you get all updated stats without getting into the calculation that makes the O(1) time complexity for /statistic end point. Scheduled process takes care of deletion of transaction which are older than 60 seconds ,hence maintaing the space complexity to the number of transaction intiated in last 60 seconds. API are thread safe and allow concurrent updates on the list that makes the solution more robbust.

Technology stack

  1. Sping Boot Framework for writing Rest API
  2. Spring Tool Suite for code development
  3. Maven as a dependency management system
  4. Docker for containring the solution

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment notes on how to deploy the project in your system

Prerequisites

Code can be started with docker as well in normal way provide you have jdk & maven installed in your system. If want to run the code in docker,Docker machine should be up and running. Docker compose should be installed

Deployment

Test cases will take at least a minute and few seconds because in one of the test case delay of 61 seconds has been introduced.

  1. In Conatiner
  1. Without Conatiner

Testing with bulk Requests

If you want to test the code and post some transaction data to service you can do it in an autaomated faishon by following the below instructions.

  • cd transaction_statistic_streaming_service/
  • ./automatedCurl.sh 5000 0

Just call automated curl with two arguments.

First argument take the number of request you would like to make. Second argument introduce delay(in seconds) between every request.

Rest end points

##Author

  • Manish Jain

transaction_statistic_streaming_service's People

Contributors

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