5.1.1 • Published 6 years ago

pomegranate-task-utilities v5.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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

  • 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

3.1.2

6 years ago

5.1.1

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

5.1.0

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.0.0

8 years ago

1.0.0

8 years ago

0.0.1

8 years ago