pomegranate-task-utilities

5.1.1 • Public • Published

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

./lib/RpcReply.js

Meta

./lib/TaskBuilder.js

Meta

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

  • msg Object And object that will be stringified.
  • options Object RabbitMQ message options.
    • options.correlationId string RMQ correlation ID
    • options.replyTo string RMQ callback queue

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

Returns TaskBuilder

notifyQueue

Sets the queuename that a message should send back to.

Parameters

Returns TaskBuilder

payloadProp

Adds a key-value to the payload of the task.

Parameters

Returns TaskBuilder

notifyProp

Adds a key-value to the payload of the notify task.

Parameters

Returns TaskBuilder

build

Builds your Task Object.

Parameters

  • prop string debug only, returns just this property from .payload

Returns any

Package Sidebar

Install

npm i pomegranate-task-utilities

Weekly Downloads

0

Version

5.1.1

License

MIT

Unpacked Size

205 kB

Total Files

18

Last publish

Collaborators

  • paperelectron