1.2.43 • Published 9 years ago

collectortoqueue v1.2.43

Weekly downloads
-
License
ISC
Repository
-
Last release
9 years ago

collectortoqueue

This library is in alpha. We will make an effort to support the library, but we reserve the right to make incompatible changes when necessary.

It is a distributed task Manager based on Kue. (node.js)

The goal of library collectortoqueue is a library to manage task with kue (node.js)

It is composed with 3 parts:

1) Collector : collect data from source (database, Mongo, Mysql, Redis, text file or array) 2) TaskManager : Do Something with data 3) Saver : Save Data Somewhere (Mongo, MySql, Redis, ...)

Simple Example

We create 2 files :

  • produce.js : for produce task.
  • consume.js : for compute tasks. Comsume.js can be deploy in a large number of machine or VM. The task has process

###Create file producer.js


   //define the source of data (here mysql)
   var collector = new ctq.GetSqlData('database', 'table', config.mysql);
   
   //prepare data to be send in kue
   var jobMaster = new ctq.JobKue(config.redis, collector);
  
   //run : the database in send in the redis kue by groupe of 5000.
   jobMaster
            .init()
            .then(jobMaster.exec())
            .then(function () {
                console.log('====================== all task has been send to Kue ======================');
            })
            .catch(function (e) {
                console.log(e)
            });
    

More complexe Example

In file producer.js


   //define the source of data
   var collector = new ctq.GetSqlData('myDatabase', 'emails', config.mysql);
   
   //we don't want to collect every thing we add a filter
   collector.filter = "WHERE email<>''";
   //it means we start by row 0
   collector.start = 0;
   //it mean we collect 5000 rows each time
   collector.size = 5000;
   
    //prepare data to be send in kue
    var jobMaster = new ctq.JobKue(config.redis, collector);
    //nb of job send in the same time
    jobMaster.type = 'url';
    
    //run : the database in send in the redis kue by groupe of 5000.
    jobMaster
            .init()
            .then(jobMaster.exec())
            .then(function () {
                console.log('====================== all task has been send to Kue ======================');
            })
            .catch(function (e) {
                console.log(e)
            });
    

1 collector

The collector collect data from source (database, text file or array)

2 TaskManager

3 Saver save data in location (Mongo, MySql, Redis, ...)

example of collector in this module

Txt file MySql Mongo

1.2.43

9 years ago

1.2.42

9 years ago

1.2.41

9 years ago

1.2.40

9 years ago

1.2.39

9 years ago

1.2.38

9 years ago

1.2.37

9 years ago

1.2.36

9 years ago

1.2.34

9 years ago

1.2.33

9 years ago

1.2.32

9 years ago

1.2.31

9 years ago

1.2.30

9 years ago

1.2.29

9 years ago

1.2.28

9 years ago

1.2.27

9 years ago

1.2.26

9 years ago

1.2.25

9 years ago

1.2.24

9 years ago

1.2.23

9 years ago

1.2.22

9 years ago

1.2.21

9 years ago

1.2.20

9 years ago

1.2.19

9 years ago

1.2.18

9 years ago

1.2.17

9 years ago

1.2.16

9 years ago

1.2.15

9 years ago

1.2.14

9 years ago

1.2.13

9 years ago

1.2.12

9 years ago

1.2.11

9 years ago

1.2.10

9 years ago

1.2.9

9 years ago

1.2.8

9 years ago

1.2.7

9 years ago

1.2.6

9 years ago

1.2.5

9 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.25

9 years ago

1.0.24

9 years ago

1.0.23

9 years ago

1.0.22

9 years ago

1.0.21

9 years ago

1.0.20

9 years ago

1.0.19

9 years ago

1.0.18

9 years ago

1.0.17

9 years ago

1.0.16

9 years ago

1.0.15

9 years ago

1.0.14

9 years ago

1.0.13

9 years ago

1.0.12

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago