Gathering detailed insights and metrics for theta-mn-queue
Gathering detailed insights and metrics for theta-mn-queue
Gathering detailed insights and metrics for theta-mn-queue
Gathering detailed insights and metrics for theta-mn-queue
Theta MN Queue is an easy to use queue system with support for multiple data sources.
npm install theta-mn-queue
Typescript
Module System
Node Version
NPM Version
TypeScript (97.08%)
JavaScript (2.92%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
50 Commits
1 Forks
2 Watchers
1 Branches
1 Contributors
Updated on Feb 17, 2024
Latest Version
3.0.6
Package Id
theta-mn-queue@3.0.6
Unpacked Size
39.18 kB
Size
9.68 kB
File Count
48
NPM Version
8.11.0
Node Version
16.16.0
Published on
Feb 24, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
20
Theta Queue is an easy to use queue system with support for multiple data sources developed in TypeScript and has been designed and developed from the ground up.
A history of changes have been given in the file CHANGELOG.md (https://github.com/mustafaneguib/theta-mn-queue/blob/master/CHANGELOG.md)
Install theta-mn-queue with npm
1 npm i theta-mn-queue 2
or
1 yarn add theta-mn-queue
1import { Queue, Document } from 'theta-mn-queue'; 2 3/** 4 * The method setupQueue itself is given for demonstration purposes. 5 */ 6async function setupQueue() { 7 8 let queue_name = 'queue1'; 9 //A new queue will be created with the name queue1 10 let queue: Queue = new Queue(queue_name); 11 await queue.purge();//This method will remove any lingering queues in the database that have the same name as the one that has been provided. 12 13 //A new document has been created and is being queued into the queue. The method call queue.getNextIndex() returns the next usable index. Use this method to get a sequence of numbers that can be used as ids. 14 let document: Document = new Document({id: (await queue.getNextIndex()), key: 'hello', content: 'world'}); 15 await queue.enqueue(document); 16 17 document = new Document({id: (await queue.getNextIndex()), key: 'hello', content: 'world'}); 18 await queue.enqueue(document); 19 20 //At this stage the queue will be containing two items 21 22 //The commit method ensures that the queue is persisted and saved to the database. 23 await queue.commit(); 24 25} 26 27setupQueue(); 28
This is a TypeScript interface that is being used as a type and has the following structure:
1{ 2 id: number; 3 key: string; 4 content: string; 5}
This is the basic type that gets stored in the data storage as well. The definition of this type has only been given for sake of completion and is not exported and should not be used directly. The Document class uses Resource type directly.
The getResource method returns a Resource type.
The getItd method gets the id of the document.
The getKey method gets the key of the document.
The getContent method gets the content of the document.
The public methods of QueueProcessor accept the Document object where required.
This method returns the name of the queue
This method initializes the queue and sets up the required infrastructure for the queue to function smoothly
This method writes to the designated data storage persisting it permanently unless removed from the data storage.
This method purges(removes) the queue from the database.
This method enqueues the document to the back of the queue.
This method dequeues the document from the front of the queue and returns it.
This method returns the document at the front of the queue without removing it from the queue.
This method returns whether the queue is empty or not.
This method returns the number of items in the queue.
This method gets the next index of the queue
The features that have been marked as check have been implemented while those that are planned to be implemented are marked as unchecked.
Please refer to the file .env.example that has been provided in the codebase with keys and their sample values.
BASE_URL
PORT
MONGO_URL
REDIS_PORT
DATA_DRIVER
Server: TypeScript, NodeJS
If you have any feedback, please reach out to us at mustafa.neguib@gmail.com
Theta MN Queue is in active development and invites software engineers and software developers to help us in making this library one of the best queue and job scheduling library that there can be. We are actively seeking contributors to help us take this project forward.
We are also interested in getting help in improving the documentation for this project so that it is easy to read and understand.
If you find a bug in the code do create an issue in the issue tracker https://github.com/mustafaneguib/theta-mn-queue/issues and if you work on fixing it do create a merge request with the details of the fix so that it can be applied.
No vulnerabilities found.
No security vulnerabilities found.