You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -24,8 +24,8 @@ See the [Why do I need a task queue?](#why-do-i-need-a-task-queue) section for m
24
24
25
25
## Requirements
26
26
27
-
- Node
28
-
-Note: RSMQ uses the Redis EVAL command (LUA scripts) so the minimum Redis version is 2.6+.
27
+
- Node.js version 4.7 or greater
28
+
-Redis version 2.6 or greater, due to RSMQ's use of the Redis EVAL command (LUA scripts)
29
29
30
30
## Installation
31
31
@@ -35,23 +35,19 @@ See the [Why do I need a task queue?](#why-do-i-need-a-task-queue) section for m
35
35
36
36
2. Ensure you have a Redis server running and accessible
37
37
38
-
3.Ensure your project contains a *config* directory in the root, plus a *log* directory and a *workers* directory
38
+
3.*config*, *log* and *workers* directories will be automatically created in the root of your project, if they don't already exist
39
39
40
-
4.Copy and rename the sample config file from the **@dadi/queue** module:
40
+
4.Amend the configuration file *config/config.development.json* according to the following section
41
41
42
-
*config.development.json*
43
-
44
-
5. Amend the config file according to the following section
45
-
46
-
6. Require the **@dadi/queue** module from your project:
42
+
5. Require the **@dadi/queue** module from your project:
47
43
48
44
`require('@dadi/queue')`
49
45
50
-
7. Run the project to start listening for messages:
46
+
6. Run the project to start listening for messages:
51
47
52
48
`npm start`
53
49
54
-
## Config
50
+
## Configuration
55
51
56
52
***queue**
57
53
***host**: (*ipaddress; default = 127.0.0.1*) The queue server host IP
@@ -137,6 +133,16 @@ A worker should export a function that receives 3 parameters:
137
133
*`queue` : An instance of the queue itself for sending further messages
138
134
*`done`: A function to call when processing is complete
139
135
136
+
**An example worker**
137
+
```js
138
+
// ./workers/hello-world.js
139
+
140
+
module.exports= (req, queue, done) => {
141
+
console.log('hello world')
142
+
done()
143
+
}
144
+
```
145
+
140
146
### Success
141
147
142
148
On success, a worker should call `done()`, which will notify the broker to delete the message. This will also release the throttle if it is currently in operation.
0 commit comments