Provides helper functions for working with Pomegranate-Task-Runner
yarn add pomegranate pomegranate-task-utilities
# Or..
npm i -S pomegranate pomegranate-task-utilities
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: {}
}
]
}
}
Soon...
./lib/TaskValidator.js
Meta
- author: Jim Bulkowski <[email protected]>
- license: MIT {@link http://opensource.org/licenses/MIT}
./lib/RpcReply.js
Meta
- author: Jim Bulkowski <[email protected]>
- license: MIT {@link http://opensource.org/licenses/MIT}
./lib/TaskBuilder.js
Meta
- author: Jim Bulkowski <[email protected]>
- license: MIT {@link http://opensource.org/licenses/MIT}
Examples
let valid = new TaskValidator(Data)
.payload(['some', 'paths'])
.notify(['other', 'paths'])
.validate()
Add paths required
Parameters
paths
Returns TaskValidator
Parameters
paths
Returns TaskValidator
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.
Formats and sends Remote Procedure Call replies.
Parameters
Returns Promise
Examples
let Task = new TaskBuilder()
.task('my.awesome.task')
.payloadProp('level', 'Awesome')
.build()
Sets the task name that this builder will target.
Parameters
taskName
string the taskname to build
Returns TaskBuilder
Sets a taskname to notify
Parameters
notifierTaskName
string
Returns TaskBuilder
Sets the queuename that a message should send back to.
Parameters
queueName
string -
Returns TaskBuilder
Adds a key-value to the payload of the task.
Parameters
prop
stringval
any
Returns TaskBuilder
Adds a key-value to the payload of the notify task.
Parameters
prop
stringval
any
Returns TaskBuilder
Builds your Task Object.
Parameters
prop
string debug only, returns just this property from .payload
Returns any