Skip to content

stepdi/tarantool-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tarantool-queue

Simple wrapper for Tarantool Queue for NodeJS (ES6). It accepts Tarantool connection from tarantool/node-tarantool-driver

Module Queue for Tarantool is required (if you use Official Tarantool Docker image you already have it, if you do not please install the Queue module - here is described how) To check if you have the Queue module installed run in your Tarantool console:

Lua> queue = require('queue')

Install

npm i @stepdi/tarantool-queue

Sample usage (worker):

import Tarantool from 'tarantool-driver';
import TarantoolQueue from '@stepdi/tarantool-queue';

async function worker() {
    let conn = new Tarantool({ port: 3301 });
    let q = new TarantoolQueue(conn, 'myQueue');
    
    async function processTask(t) {
        return new Promise((resolve, reject) => {
                q.ack(t[0][0]).then(resolve).catch(reject);
        });
    }
    
    try {
        let task;
        while (task = await q.take()) {
            await processTask(task);
        }
    } catch (err) {
        console.log('Error:', err);
    }
}

worker();

Functions supported

Please refer to Tarantool Queue module documentation using links in the list. Every function returns a Promise which resolves with data from Tarantool or rejects with error message.

and extra function:

  • getAll() – select all items from queue

About

Wrapper for Tarantool Queue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors