Module: wrappers

Application wrapper functions for typical use cases with npac

Methods

(static) runJob(config, executives, jobDesc, cb)

Run an asynchronous executive function in a plain container

The function builds a container that provides only config, logger and the executives given as a parameter, then executes the synchronous job, that is defined by the jobDesc parameter.

Parameters:
Name Type Description
config Object

The configuration parameters of the container.

executives Object

The executives, that must contain at least the async job function that is referred by the jobDesc argument.

jobDesc Object

The job { name: {String}, args: {Object} } descriptor object.

cb function

An error-first callback function, will be called with th re final results of container run.

(static) runJobSync(config, executives, jobDesc, cb)

Run a synchronous executive function in a plain container

The function builds a container that provides only config, logger and the executives given as a parameter, then executes the synchronous job, that is defined by the jobDesc parameter.

Parameters:
Name Type Description
config Object

The configuration parameters of the container.

executives Object

The executives, that must contain at least the sync job function that is referred by the jobDesc argument.

jobDesc Object

The job { name: {String}, args: {Object} } descriptor object.

cb function

An error-first callback function, will be called with th re final results of container run.