Giter Site home page Giter Site logo

thyme's Introduction

What's this?

A queue / cron manager for beanpole based apps, kinda like cron jobs.

What can it do?

  • Register a request to call at a specific time.
  • Register a ton of calls at an unspecified time, and thyme will send them immediately, one after the other.
  • If a request fails, you can specify the time to try and make the request again, and the number of times to send the request before disposing it.
  • You can specifed a number of concurrent requests to make at any given time.

Requirements

  • node.js
  • rabbitmq
  • haba
  • daisy

Usage

Startup the thyme server:

thyme

In your master server:

var router = require('beanpoll').router(),
loader = require('haba').loader();

loader.require({
	daisy: {
		remoteName: 'app-master',
		transport: {
			rabbitmq: 'localhost'
		}
	}
});

router.on({
	
	'push -hook thyme/ready': function() {
		
		this.from.push('thyme/worker', { channel: 'do/work', queue: 'app-slave' });

	},

	'push -hook app-slave/ready': function() {
		
		router.push('thyme/enqueue', { queue:'app-slave', channel: 'do/work', data: data.message, sendAt: Date.now() + cron.timeout('* * * * * *') });
		
	}
});

In your slave server (worker):

var router = require('beanpoll').router(),
loader = require('haba').loader(),
cron = require('cron');

loader.require({
	daisy: {
		remoteName: 'app-slave',
		transport: {
			rabbitmq: 'localhost'
		}
	}
});

router.on({
	
	'pull -hook do/work': function(data) {
		
		//re-add the job with NEW data N seconds from now
		res.end({ sendAt: Date.now() + 1000, data: 'new data' });
	}
});

To Do:

  • ordering queue based on request/response speed.
  • need to check if call exists before making it.
  • don't send queues of handler is not present.

thyme's People

Stargazers

Craig Condon avatar Drew avatar

Watchers

Craig Condon avatar James Cloos avatar  avatar

thyme's Issues

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.