Giter Site home page Giter Site logo

simple-job-queue's Introduction

simple-job-queue

Simple in-memory job queue with a REST API.

TODOs

  • Missing tests for handler and queue packages
  • Need to create Dockerfile and docker-compose for running the service in a container
  • Needs better observability: emit stats, handle tracing, more logging.
  • Could use some clean up in main (possibly using wire to construct dependencies)

Local Dev

Testing

Run make test

Linting

Run make lint

Running locally

Run go run main.go

Spec:

The queue exposes a REST API that producers and consumers perform HTTP requests against in JSON. The queue supports the following operations:

/jobs/enqueue

Add a job to the queue. The job definition can be found below. Returns the ID of the job

/jobs/dequeue

Returns a job from the queue Jobs are considered available for Dequeue if the job has not been concluded and has not dequeued already

/jobs/{job_id}/conclude

Provided an input of a job ID, finish execution on the job and consider it done

/jobs/{job_id}

Given an input of a job ID, get information about a job tracked by the queue

A job has the following attributes as part of its public API:

ID: an integer to uniquely represent a job

The ID is assigned to a job by the queue once the job is enqueued

Type: a string representing the class of operation

There are two types: TIME_CRITICAL and NOT_TIME_CRITICAL. Type is sent from the producer when a job is enqueued. The Type is not considered by dequeue’s business logic.

Status: an enum value indicating the current stage of the jobs’ execution.

There are 3 statuses: QUEUED, IN_PROGRESS, CONCLUDED

An example job returned from jobs/{job_id} could look like:

{
 "ID": 951,
 "Type": "TIME_CRITICAL",
 "Status": "IN_PROGRESS"
}

simple-job-queue's People

Watchers

James Cloos avatar Ben Krebsbach 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.