- Quiddity is a simple server that connects to MongoDB and exposes few APIs like push, fetch & delete.
- A seperate light-weight agent consumes these APIs and allows the user to push/pull messages from the queue.
- The user can also have multiple agents working on the queue.
docker run -d --name quiddity -p 3000:3000 --env MONGO_URL="<URL>" kevinjain/quiddity:1.0.0
Clone the master branch of this repo
git clone --single-branch -b master https://github.com/thatsKevinJain/quiddity.git
Then run the start script -
npm start
You can also pass the following enviornment variables to configure the server.
Enviornment Name | Default Value | Datatype |
---|---|---|
PORT | 3000 | Number |
MONGO_URL | "mongodb://localhost:27017/" | String |
MESSAGE_EXPIRY_TIME | 300000 (5 mins) | Number (in millis) |
MAX_PROCESS_COUNT | 2 | Number |
-
MAX_PROCESS_COUNT
- Quiddity follows a atleast once policy while processing messages.
- This means your message can be processed more than once if the agent/worker fails to acknowledge the message.
- Developers can set this count as 1 if they want to process their message only once.
-
MESSAGE_EXPIRY_TIME
- If the agent crashes or takes too long to acknowledge the job completion, the message is marked expired and put back into the queue.
- Developers can extend this expiry time if their messages take longer to process.
You can use the following NPM library to setup the agent, check the documentation for implementation. quiddity-agent
push
and pull
commands were tested on -
NodeJS v12.18.0
| MongoDB v4.2
| MacOS v10.15
| 8GB RAM
| 1.6GHz DualCore Intel i5