npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@evolving-bubble/redis-q

v1.0.1

Published

Redis Queue for jobs

Downloads

5

Readme

Redis-Q Job Manager

Manage jobs using redis queues

Preface

In normal scenario, tracking and processing job is little typical. This library is trageted to make that simpler and effective

Features

  1. Create a job.
  2. Delete a job.
  3. Track a job progress.
  4. Generate job reports

Getting started.

Redis-Q Job manager will work on all systems which can run node.

Install

npm install @evolving-bubble/redis-q

Usage

Examples

  • Create a publisher

Will create a publisher connection with redis, when redis isReady we can start pushing data

const JobManager = require('@evolving-bubble/redis-q')
const publisher = new JobManager.Publisher({
    redis: {
        connectionType: 'NORMAL',
        host: 'localhost',
        port: '6379',
    },
    jobPrefix: 'JobManager'
});

if(publisher.isReady()){
    publisher.push([{ 1: 1, 2: 2 }]);
}
  • Create a db publisher

Will create a DB publisher connection with redis, when redis isReady we can start pushing data, it will fetch data from db using searchOptions and will push in redis as part of job

const JobManager = require('@evolving-bubble/redis-q')
const dBPublisher = new JobManager.DbPublisher({
    jobName: 'test-DBPublisher',
    schedulerTime: '*/1 * * * * *', // Every 10 secs
    db: {
        host: 'localhost',
        port: '3306',
        user: 'username',
        password: 'password',
        database: 'testDatabase',
        table: 'testTable',
        tableFields: [
            {
                key: 'order_id',
                type: 'varchar'
            },
            {
                key: 'customer_id',
                type: 'varchar'
            },
        ],
        searchOptions: [{
            key: 'order_id',
            operator: 'eq',
            value: '4295046610'
        }]
    },
    redis: {
        host: 'localhost',
        port: '6379',
        connectionType: 'NORMAL'
    },
    jobPrefix: 'JobManager'
});

dBPublisher.exec();
  • Create a subscriber

Will create a subscriber that will be listening to queues and will run the callback if some message gets added to Queue

const JobManager = require('@evolving-bubble/redis-q')
const subscriber = new JobManager.Subscriber({
    redis: {
        connectionType: 'NORMAL',
        host: 'localhost',
        port: '6379',
    },
    jobPrefix: 'JobManager',
    callback: (message) => {
        return new Promise((resolve, reject) => {
            Promise.resolve()
                .then(() => {
                    console.log(message);
                    return resolve();
                })
                .catch((error) => {
                    return reject(error);
                });
        })
    },
    callbackTimeOut: 2 * 1000
});
subscriber.process();
  • Create a job

Will create a job object to track job progress and to generate reports

const job = new Job({
    redis: {
        connectionType: 'NORMAL',
        host: 'localhost',
        port: '6379',
    },
    jobPrefix: 'JobManager'
});

setTimeout(() => {
    job.generateCSVReport('6372bae0-14ed-4b0e-bd61-6775ff81f2e5');
    job.generateJSONReport('4ff188bd-5572-4455-bcac-f5c758e9f924');
    job.peek('4ff188bd-5572-4455-bcac-f5c758e9f924');
}, 1000);

How to contribute

Have an idea? Found a bug? See how to contribute.

Have a problem? Come chat with us!

LinkedIn Twitter Github Gmail

Maintained by

Yogesh Yadav

Support my projects

I open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).

However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:

  • Starring and sharing the projects you like
  • Paytm You can make one-time donations via Paytm (+91-7411000282). I'll probably buy a coffee.
  • UPI You can make one-time donations via UPI (7411000282@paytm).
  • Bitcoin You can send me bitcoins at this address (or scanning the code below): 3BKvX4Rck6B69JZMuPFFCPif4dSctSxJQ5

Thanks!

Where is this library used?

If you are using this library in one of your projects, add it here.

License

MIT © Yogesh Yadav