0.1.6 • Published 12 years ago

thyme v0.1.6

Weekly downloads
54
License
-
Repository
-
Last release
12 years ago

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.
0.1.6

12 years ago

0.1.5

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago

0.0.6

12 years ago

0.0.5

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago

0.0.4

12 years ago

0.0.3

13 years ago