Skip to content

Simple to use Message Broker implemented as REST API

License

Notifications You must be signed in to change notification settings

farawayCC/lowmq

Repository files navigation

LowMQ

Simple to use message broker written in TS. Utilizing the simplicity, power and omnipresence of HTTP requests.

Run the broker server

Production

  • download the latest release wget https://github.com/farawayCC/lowmq/releases/latest/download/lowmq.zip
  • unzip it unzip -q lowmq.zip
  • change the directory into unzipped folder cd lowmq-latest
  • run using node node lowmq.js

The server is up. Navigate to http://yourDomain:8788/help for help

Development

  • clone the repository git clone https://github.com/farawayCC/lowmq.git
  • install dependencies npm i or yarn
  • start the server with npm start or yarn start

The server is up. Navigate to http://localhost:8788/help for help

Usage

Basic messaging

Add a message to the queue

curl -X POST -H "Authorization: token woof" -H "Content-Type: application/json" -d '{"key": "test", "value": "Hello World!"}' http://localhost:8788/msg

Get a message from the queue

curl -X GET -H "Authorization: token woof" "http://localhost:8788/msg?key=test"

Delete a message from the queue

curl -X DELETE -H "Authorization: token woof" "http://localhost:8788/msg?key=test&_id=123456789" please note that the _id is the id of the message in the queue. You can get it from the GET request.

NodeJS client

NPM packet: lowmq-client

Python client

Python packet: lowmq-client

Project Structure

  • src/: This directory contains the TypeScript source code of the application. The entry point of the application is index.ts.

  • lowmq.js: This is the output file generated by Rollup from the TypeScript source code.

  • package.json: This file contains the metadata of the project and the scripts for building, starting, and testing the application.

  • rollup.config.js: This file contains the configuration for Rollup, which is used to bundle the TypeScript source code into a single JavaScript file.

  • .gitignore: This file specifies the files and directories that should be ignored by Git.

  • resources/: This directory contains HTML and JavaScript files for the web controller and help page of the application.

  • test/: This directory contains the test files for the application. The tests are run using Mocha.

  • prepare-release.sh: This is a shell script for preparing a release of the project. It checks the working directory, cleans the project, builds the project, and prepares the release directory.