Git Product home page Git Product logo

async-task's Introduction

Async Task

Async Processor with Retry Mechanism

Setup and Compilation

Prerequisites

  1. Maven
  2. JDK 17
  3. Docker
  4. docker compose

Please make sure that the above tools are installed and configured properly.

Compilation

cd to async-task project directory, then do the following

git pull https://github.com/ganeshtiwari/async-task.git
cd async-task
docker compose up rabbitmq -d
mvn clean package
docker compose up --build -d

Simulation

To run the simulation
watch logs docker logs async-app -f

send post request curl -X POST http://localhost:8080/simulate.

Execution process

This endpoint will produce 5 string messages to the processingQueue. The active processingConsumer will consume these string messages. For each message, an AsyncJob will be created and added to the jobs list. These jobs will be scheduled in an async executor service. Fist the job status will be updated to RUNNING status and then the executing thread will sleep for some time. It then randomly tries to exit execution (for simulation of retry). If it didn't exit, the status will be either SUCCESS or ERROR.

The watching process, running on a separate thread, periodically monitors the jobs. If the job, in the job list, is complete, it removes it from watch list. Else, it checks whether the job should be rescheduled or an alert should be sent to the admin and takes that action.

State Transition of Async Job

img.png

async-task's People

Contributors

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