Socket
Socket
Sign inDemoInstall

steppe

Package Overview
Dependencies
66
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    steppe

Simple processor for jobs that have multiple steps


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Steppe - a simply queueing system for linear jobs

OUTDATED!

This is outdated documentation. Please do not use this module yet. It will soon be available on npm.

    var Steppe = require('steppe');
    var steppe = new Steppe();

    steppe.configure({
        db: {
            type: 'mongo',
            uri: 'mongodb://localhost/testdb'
        },

    });

    // This function returns a promise.
    function handleChild(childData, parentData) {
        // Generate a promise with your favourite promise library.
        var promise = ...;

        doStuff(childData, parentData)
        .then(function(result) {
            promise.resolve(result);
        })
        .catch(function(error) {
            if (error === 'everything went wrong') {
                promise.reject({
                    fatal: true,
                    error: error
                });
            }
            else {
                promise.reject({
                    fatal: false,
                    error: error
                });
            }
        });

        return promise;
    }

    // This function is called either after the last child has been processed,
    // or after a child has errored in a fatal way.
    function handleParent(parentData) {
        if (parentData.status === steppe.status.error) {
            console.error('Error: %s', parentData.error);
        }
        else {
            console.info('Parent %s processed successfully', parentData.id);
        }
    }

    steppe.defineQueue({
        name         : 'makePhotoAlbum',
        parentHandler: handleParent,
        childHandler : handleChild,
        period       : 'every 20 seconds'
    });

    steppe.start();

    steppe.createJob({
        queueName: 'makePhotoAlbum',
        parent: {
            url: 'http://photoalbums.example.net',
            auth_token: '1751FC0703C943D8904DAFCAD6F5814941CD1',
        },
        children: [
            {
                type: 'createPhotoAlbum',
                albumName: 'My Pets',
            },
            {
                type: 'uploadPhoto',
                filename: '/tmp/photo01.png',
                description: 'my cat',
            },
            {
                type: 'uploadPhoto',
                filename: '/tmp/photo02.png'
                description: 'my dog',
            },
            {
                type: 'publishAlbum'
            }
        ]
    });

Keywords

FAQs

Last updated on 10 Dec 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc