Code Monkey home page Code Monkey logo

event-driven-knapsack-microservices's Introduction

Project : Event-Driven Knapsack Micorservice (Knapsack solution as a Service)

Technology stack

  1. Spring Boot for writing Microservice
  2. Kafka for Event Store
  3. STS(Spring tool suite) for code development
  4. Maven for dependency management
  5. Docker for containerizing the solution

Code provide "knapsack solution" as a service that runs in a docker container.

You can do below things via rest services

  1. Submit knapsack probelm.
  2. Retrive the task status and their solutions.
  3. Get the complete list of tasks and the stage in which they are currently running.(stages = submitted ,started,completed).

Microservice Archtiecture

Overall Solution contains 3 microservices(Input,Solution,Admin), running in separate docker containers and Kafka container as a event store to make async communocation between different services.

  1. User facing Input Microservice to get the knapsack problem in and provide the status and solution of individual problem.
  2. Solution Microservice reads the new problem from kafka , process the solution and post the solution back to kafka.
  3. Admin Microservice reads for first two micorservices for any new knapsack problem or update of on existing problem and update its state accordingly to provide the overall view of all the problems.

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 deploymentnotes to deploy the project on a live system.

Prerequisites

Docker machine should be up and running and docker-compose should be installed

Deployment

  1. git clone https://github.com/Manishmbm2010/Event-Driven-Knapsack-Microservices.git
  2. cd Event-Driven-Knapsack-Microservices
  3. cd KnapSackInput/
  4. docker run -it --rm -v "$PWD":/usr/src/app/ --volume "$HOME"/.m2:/root/.m2 -w /usr/src/app/ maven:3-jdk-8-alpine mvn clean install
  5. cd ../KnapSackSolution/
  6. docker run -it --rm -v "$PWD":/usr/src/app/ --volume "$HOME"/.m2:/root/.m2 -w /usr/src/app/ maven:3-jdk-8-alpine mvn clean install
  7. cd ../KnapSackAdmin/
  8. docker run -it --rm -v "$PWD":/usr/src/app/ --volume "$HOME"/.m2:/root/.m2 -w /usr/src/app/ maven:3-jdk-8-alpine mvn clean install
  9. docker-compose up --build

Rest end points

Input/Output Json format has been attached in separate file withe examples , Please have a look end_point_input_output_format.txt

Yet to Be configured:

Running the tests

Automated test case suit has not been added with the project.

Time complexity for calculating the solution

Time Complexity: O(nW) where n is the number of items and W is the capacity of knapsack.

Built With

  • Maven - Dependency Management

Acknowledgments

Find we few best resources for finalizing the design and completeing the project

Scope for improvement

  • Currently solution has been designed with embedded derby database , can be configured with separate database docker image with persistent mount.
  • kafka container can be mounted on persistent storage.
  • Spring security can be implemented.
  • Deployment instruction can be prepared to deploy on Kubernetes cluster.
  • Exception handling has to be added.
  • Logging can be enhanced.
  • Comments can be improved and extended further to make the maintenace of code much simpler later on.

Author

Manish Jain

event-driven-knapsack-microservices's People

Contributors

manishmbm2010 avatar

Stargazers

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