Giter VIP home page Giter VIP logo

combee's Introduction

combee

Installation

npm i -g combee

Usage

combee --redis=redis://localhost:6379 --queues=foo,bar
combee::> combee.listQueues()
[ { name: 'foo' }, { name: 'bar' } ]

combee::> combee.foo.stats()
undefined
combee::> { waiting: 1,
  active: 0,
  succeeded: 0,
  failed: 0,
  delayed: 0,
  newestJob: 6 }

combee::> combee.foo.list()
undefined
combee::> []

combee::> combee.foo.list('waiting')
undefined
combee::> [ { id: '6',
    data: { yolo: 'solo' },
    options: { timestamp: 1561948255429, stacktraces: [] },
    status: 'created' } ]

combee::> combee.foo.createJob({yolo:'yolo'})
undefined
combee::> { id: '7',
  data: { yolo: 'yolo' },
  options: { timestamp: 1561948417944, stacktraces: [] },
  status: 'created' }

combee::> combee.foo.list('waiting')
undefined
combee::> [ { id: '7',
    data: { yolo: 'yolo' },
    options: { timestamp: 1561948417944, stacktraces: [] },
    status: 'created' },
  { id: '6',
    data: { yolo: 'solo' },
    options: { timestamp: 1561948255429, stacktraces: [] },
    status: 'created' } ]

combee::> combee.foo.removeJobs('waiting', { 'data.yolo': 'solo' })
undefined
combee::> removed 1 jobs

combee::> combee.foo.list('waiting')
undefined
combee::> [ { id: '7',
    data: { yolo: 'yolo' },
    options: { timestamp: 1561948417944, stacktraces: [] },
    status: 'created' } ]

combee::> combee.foo.find('waiting', {'data.yolo': 'yolo'})

combee::> combee.foo.count('waiting', {'data.yolo': 'yolo'})

combee::> combee.foo.distinct('waiting', 'data.yolo', {})

Streaming operations

Not streaming in the Node.js stream sense, but a fluent AsyncIterable/Iterator based API.

combee::> for (let i = 0; i < 10; i++) { combee.foo.createJob({ x: i, y: 2 * i }) }

// remove all waiting jobs where data.x + data.y < 10, log when done
combee::> combee.foo.iterate('waiting').filter((job) => job.data.x + job.data.y < 10).forEach((job) => job.remove()).then(() => console.log('done'))

// collect all waiting jobs where data.x is even in an array
combee::> let evenX; combee.foo.iterate('waiting').filter((job) => job.data.x % 2 === 0).toArray().then((res) => evenX = res)

Advanced usage

Loading optional functions into the REPL

If you have utility functions or extra functions that you'd like to load, you can do so via the --loadFunctions parameter, which can be used as follows:

node repl.js \
    --redis=redis://localhost:6379 \
    --loadFunctions=./examples/functionsToLoad.js \
    --queues=bar,foo

The file passed to --loadFunctions must expose single a top level function which accepts the REPL context as the only parameter to it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.