Skip to content

A Spring(java) based microservice to save/retrieve chat logs on the server.

Notifications You must be signed in to change notification settings

sanskar-thakur/chatLogServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat Log Server

A Spring(java) based microservice to save/retrieve chat logs on/from the server.

This server presents an HTTP interface with the following commands.

POST /chatlogs/{user}

Creates a new chatlog entry for the user with userID as {user}.
The POST data can either be url encoded or JSON encoded.

The data contains the following fields:
■ message - a String representing the message text
■ timestamp - a Long representing the timestamp
■ isSent - a Boolean/Integer representing if this message was sent by the user or received by the user.

The response from the message is a unique messageID that we can refer to the message by.

GET /chatlogs/{user}

Returns chatlogs for the given user.
These are returned in reverse timeorder (most recent messages first).

Takes two optional parameters.
■ limit - an Integer stating how many messages should return. Default to 10.
■ start - a key of the same type as messageID to determine where to start from.
This is to help implement pagination. If not set, it returns the most recent messages.

DELETE /chatlogs/{user}

Deletes all the chat logs for a given user.

DELETE /chatlogs/{user}/{msgid}

Delete just the given chatlog for a given user.
Returns an appropriate HTTP error response if the msgid is not found.

Pre-requisites

  1. The project uses PostgreSQL as data store for chat logs.
  2. The project requires a database server (postgreSQL) running on the host machine.
  3. Run db script from the project (create_db.sql) to create required db schemas.

About

A Spring(java) based microservice to save/retrieve chat logs on the server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages