Giter Site home page Giter Site logo

marvin-j97 / corinth Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1014 KB

๐Ÿ“ฌ Portable message queue written in Rust

Home Page: https://marvin-j97.github.io/corinth/api

Rust 71.18% Dockerfile 0.59% HTML 1.28% JavaScript 0.57% Vue 26.25% SCSS 0.13%
message queue producer-consumer nickel ava

corinth's Introduction

Logo

Corinth

Build Status Docker Cloud Automated build Docker Cloud Build Status GitHub issues

Corinth is a simple and portable message queue server written in Rust.

Features

  • FIFO (strict message order, exactly-once delivery)
  • file system persistence (AOF .jsonl format)
  • explicit message acknowledgment (ack)
  • message deduplication
  • Dead-letter queues (DLQ)
  • Optional queue maximum size
  • JSON REST API

Run

Grab a pre-compiled binary (https://github.com/marvin-j97/corinth/releases).

If you're using an OS other than Windows, Linux, Mac you'll have to build a binary yourself. Run:

(Unix)
./corinth-[version]

(Windows)
corinth-[version].exe
.\corinth-[version].exe

That's it. By default the server runs on port 44444.

By using environment variables, you can change some settings:

Name Description Default
CORINTH_PORT Port the server runs on 44444
CORINTH_BASE_FOLDER Folder where persistent data is stored ./.corinth
CORINTH_COMPACT_INTERVAL Compaction interval (in seconds) 86400

API documentation

See https://marvin-j97.github.io/corinth/api/.

Getting started

Create a queue named 'my-queue'. Queues are persistent by default.

curl -X PUT http://localhost:44444/queue/my-queue

Enqueue an item to queue ('item' can be any JSON object)

curl -X POST http://localhost:44444/queue/my-queue/enqueue -H "Content-Type: application/json" --data "{ \"messages\": [{ \"item\": { \"name\": \"My item\" }, \"deduplication\": null }] }"

Dequeue item from queue

curl -X POST http://localhost:44444/queue/my-queue/dequeue

By default, messages need to be acknowledged, otherwise they will be requeued after a specific timeout. If you don't care about acknowledging, you can acknowledge on dequeuing instead:

curl -X POST http://localhost:44444/queue/my-queue/dequeue?ack=true

Acknowledge message reception

curl -X POST http://localhost:44444/queue/my-queue/[message id]/ack

Build from source

cargo build --release

Docker

https://hub.docker.com/r/dotvirus/corinth

docker pull dotvirus/corinth

Build the image

docker build -t corinth .

Where corinth is the name of the image you are about to create.

Running a new container using the image

docker run -d -it -p 127.0.0.1:8080:44444 --rm --name corinth-queue corinth

To verify if everything worked, open up a browser and enter localhost:8080

Change application port

Use the CORINTH_PORT variable to change the port Corinth will bind to.

docker run -d -it -p 127.0.0.1:8080:22222 --env CORINTH_PORT=22222 --rm --name corinth-queue corinth

Docker persistence

To create a persistent queue within Docker you need to mount a volume and make sure to correctly set the CORINTH_BASE_FOLDER environment variable.

docker run -d -it --env CORINTH_BASE_FOLDER=/corinth/.corinth -p 127.0.0.1:8080:44444 --mount source=corinthvol,target=/corinth --rm --name corinth-queue corinth

Pay attention to the --mount command. This will create a volume and mount it to your Docker container as '/corinth'. In this example, Corinth will store its persistence in the .corinth folder (/corinth/.corinth).

You can inspect the volume details using

docker volume inspect corinthvol

For more details on Docker volumes, check out the official docs here.

Node.js client

https://github.com/marvin-j97/corinth.js

corinth's People

Contributors

alexanderjanke avatar dependabot-preview[bot] avatar dependabot[bot] avatar marvin-j97 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

corinth's Issues

DELETE /queue/<id>/dequeue

Removes and returns the queue head.

?ack=true (optional): Automatically confirm reception, increments done counter
otherwise: add message to ack map, if reception is not confirmed, it will be added back to the queue

Management console

  • Create app folder with a Vue 3 Vite app.
  • Serve index.html, js & css files over server.
  • Create button component
  • Create input component
  • Queue details page
  • -> Link to DLQ if it exists
  • optionally poll for data changes
  • Purge queue button
  • Delete queue button
  • Edit queue (description, deduplication time & requeue time)
  • Create queue with DLQ
  • Create queue with description
  • Create queue with custom requeue, deduplication time, max size
  • In queue listing, optionally poll for data changes or refresh button
  • Show queue's disk & memory size in listing
  • Server info page (index page)
  • Enqueue message(s)
  • Dequeue message(s)
  • Peek queue head
  • Finishing touches/refactor

DELETE /queue/<id>/purge

Removes all items from a queue
Clear deduplication set & ack map
Rewrite files

?reset_stats=true

POST /queue/<id>/enqueue

Enqueue a new item to a queue

?deduplication_id (optional)

message gets internal ID no matter what

Auto-compact interval

  • Start interval for new queues
  • Start interval for queues loaded from disk
  • CORINTH_COMPACT_INTERVAL environment variable
  • Unit tests

Queue persistence (optional)

  • Store items
  • Load items
  • Store queue metadata
  • Apply stored queue metadata
  • Auto detect existing queues on startup
  • Unit tests

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.