Skip to content

3 application inside. First one is message receiver that receives messages from user and publishes a rabbitmq message with the message, sender and receiver content. Second one is message processor that consumes the messages from rabbitmq and saves them to the redis. The third one is message lister that lists all the messages between given two user.

Notifications You must be signed in to change notification settings

eneskzlcn/message-receiver-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About Project

The project is like a backend-service of a message program. It serves an endpoint to accept messages then it produces a rabbitmq message. Another service that consumes rabbitmq catches that message and write the message to the redis in a format that each sender-receiver grouped messages are sorted in chronological descending order. The last service is the reporting service which serves an endpoint to list all messages in chonological descending order with corresponding sender-receiver pair.

Local Setup

Firstly, you need to up the redis and rabbitmq containers which are configured in docker-compose.yml

   docker compose up -d

Then Execute:

    go run main.go

Endpoints

GET: /message: When you hit that endpoint with the request has body like {sender:"", receiver:"", message:""}, it takes that message and publishes that message to the rabbitmq.

GET: /message/list?sender=x&receiver=y When you hit that endpoint with query params sender:string, received: string,It reads the redis for senders message sent to receiver and returns a list of object array in a format like [{sender:"", receiver:"", message:""}, {sender:"", receiver:"", message:""} ] and in a chronological descending order.

About

3 application inside. First one is message receiver that receives messages from user and publishes a rabbitmq message with the message, sender and receiver content. Second one is message processor that consumes the messages from rabbitmq and saves them to the redis. The third one is message lister that lists all the messages between given two user.

Topics

Resources

Stars

Watchers

Forks