pomegranate-task-utilities v5.1.1
Pomegranate Task Utilities
Provides helper functions for working with Pomegranate-Task-Runner
Install
yarn add pomegranate pomegranate-task-utilities
# Or..
npm i -S pomegranate pomegranate-task-utilities
Configuration
This plugin exposes 1 configuration option. queues
exports.TaskUtilities = function(Env){
return {
queues: [
{
propName: 'Tasks',
queueName: Env.TASK_QUEUE_NAME,
type: 'queue',
RPC: {
enabled: true,
defaultTimeout: 1000
},
msgOptions: {
persistent: true
},
queueOptions: {}
}
]
}
}
Usage
Soon...
Detailed Documentation
Table of Contents
./lib/TaskValidator.js
Meta
- author: Jim Bulkowski <jim.b@paperelectron.com>
- license: MIT {@link http://opensource.org/licenses/MIT}
./lib/RpcReply.js
Meta
- author: Jim Bulkowski <jim.b@paperelectron.com>
- license: MIT {@link http://opensource.org/licenses/MIT}
TaskBuilder
Meta
- author: Jim Bulkowski <jim.b@paperelectron.com>
- license: MIT {@link http://opensource.org/licenses/MIT}
TaskValidator
Examples
let valid = new TaskValidator(Data)
.payload(['some', 'paths'])
.notify(['other', 'paths'])
.validate()
payload
Add paths required
Parameters
paths
Returns TaskValidator
notify
Parameters
paths
Returns TaskValidator
validate
Validates the object under test.
Parameters
logger
Object Pass in a logger to use when outputting errors.
Returns boolean Does the supplied object contain the paths provided.
RpcReply
Formats and sends Remote Procedure Call replies.
Parameters
Returns Promise
TaskBuilder
Examples
let Task = new TaskBuilder()
.task('my.awesome.task)
.payloadProp('level', 'Awesome')
.build()
task
Sets the task name that this builder will target.
Parameters
taskName
string the taskname to build
Returns TaskBuilder
notifyTask
Sets a taskname to notify
Parameters
notifierTaskName
string
Returns TaskBuilder
notifyQueue
Sets the queuename that a message should send back to.
Parameters
queueName
string -
Returns TaskBuilder
payloadProp
Adds a key-value to the payload of the task.
Parameters
prop
stringval
any
Returns TaskBuilder
notifyProp
Adds a key-value to the payload of the notify task.
Parameters
prop
stringval
any
Returns TaskBuilder
build
Builds your Task Object.
Parameters
prop
string debug only, returns just this property from .payload
Returns any