Git Product home page Git Product logo

chat's Introduction

• Instructions on how to compile your service

Need java 8 and latest maven installed 
clone the git repo
get into the project directory -> cd chat
compile using the following command 
mvn clean install

• Instructions on how to run your service locally

java  -jar target/chat-0.0.1-SNAPSHOT.jar com.ua.chat.ChatApplication

• The decisions you made

Used H2 inmemory database
Tried to deliver the features as per given spec
Integrated with Swagger to see the rest documentation
To see the swagger documentaion, use the below URL : 
  http://localhost:8080/swagger-ui.html
Written test cases for rest layer and persistency layer 
Since apis specs are expecting different type of response, i have created multiple models and resources 
Tested the service for 1 minute with 100 users and throughput is around 800 per second

• The limitations of your implementation

It has in-memory database - H2
Not integrated with relational database
No cache implementation
Limited test cases
No index on username column

• What you would do if you had more time

Good documentation of classes/interfaces
Better exception handling with error codes and custom exceptions
I would have written more unit test cases and integration test cases using karate framework 

• How you would scale it in the future

scaling application perspectinve, 
  a) need to use non blocking io /reactive programming and that makes application more scalable
  b) not using any state makes ie easier to scale horizontally       
scaling database perspectinve, data access layer need changes 

api examples:

  • POST /chat
POST /chat HTTP/1.1
Host: localhost:8080
Content-Type: application/json
cache-control: no-cache
Postman-Token: f6a45fad-916b-4b38-a726-63b2c994d5b7
{    	
"username": "paulrad", "text": "This is a messagwe2ww23", "timeout": 30
}
  • GET /chat/:id
GET /chat/2 HTTP/1.1
Host: localhost:8080
Content-Type: application/json
cache-control: no-cache
Postman-Token: 7fee5cf1-ca69-4756-ae05-151630ea99d9
{    	
"username": "paulrad", "text": "This is a messagwe2ww23", "timeout": 30
}    
  • GET /chats/:username
GET /chats/paulrad HTTP/1.1
Host: localhost:8080
Content-Type: application/json
cache-control: no-cache
Postman-Token: edee118a-06b4-4b77-88e5-b196d2f97685
{    	
"username": "paulrad", "text": "This is a messagwe2ww23", "timeout": 30
}

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.