GithubHelp home page GithubHelp logo

imaginator's Introduction

imaginator

Module for processing complex user requests. (developed by https://drive.google.com/file/d/17L5RXm1DeM51PCEkD9CXt75QnOfENbfn/view from GreenAPI)

Description

Often in development there is a situation in which it is necessary to organize cpu bound tasks that require high production loads. Such loads slow down the asynchronous operation of the service and lead to users waiting. A logical solution is an approach in which a third-party service is created that processes requests. Below is a diagram of how this service works:

  • We receive an HTTP request at the M1 microservice level.
  • Broadcast the HTTP request to the RabbitMQ queue. The request is transformed into a task.
  • We process the task with the M2 microservice from the RabbitMQ queue.
  • We put the result of processing the job in RabbitMQ.
  • We return the result of the HTTP request as the result of the execution of the job from RabbitMQ.

As an example, in this task, the handler is processing the fibonacci number with a delay

Installation

git clone [email protected]:xxbek/imaginator.git

docker compose up -d

To listen logs:

docker-compose logs --tail=0 --follow

Examples

To test the application, you must send a POST request to 0.0.0.0:8080/handle/send with the request body containing the parameter {"proceedNum":16}. You can use any client to send requests, be it curl or Postman.

curl --location '0.0.0.0:8080/handle/send' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "proceedNum": 16,
  "email": "[email protected]"
}'

You can test applications with a test script:

cd test/ && npm i && node testWithRequest.js

imaginator's People

Contributors

xxbek avatar

Watchers

 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.