Ease the implementation of multi processing accross your microservices
Clone or download
Latest commit a10ba0d Jul 4, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Example containers + interfaces Mar 10, 2017
packages v2.2.5 Jul 4, 2018
usecases doc(usecases): Gulp usecase, run tasks in different processes Nov 22, 2015
.eslintrc style(): travis, codeclimate Nov 22, 2015
.gitignore Mono repo Mar 13, 2017
.npmignore Init Nov 22, 2015
.travis.yml travis node version update Jul 4, 2018
README.md Example containers + interfaces Mar 10, 2017
appveyor.yml Mono repo Mar 13, 2017
lerna.json v2.2.5 Jul 4, 2018
package-lock.json Fix mocha Jul 4, 2018
package.json Mono-repo Mar 13, 2017


Relieve Test Coverage Code Climate Build Status Build status

The goal of this library is to ease the implementation of multi processing accross your existing microservices. Relieve aims to give a reusable design pattern using process forks. It also eases communication with child processes with an high-level abstraction.

For example, with a CallableTask:

//just export a module in the child process
module.exports = {
  print: (str) => {
  data: () => {
    //return some async data
    return Promise.resolve({foo: 'bar'})

Then from your master, just call the task:

var CallableTask = require('relieve/tasks/CallableTask')
var task = new CallableTask('task.js')

.then(() => {
  task.call('print', 'hello world')
  return task.get('data')
.then(d => {
  //d is {foo: 'bar'}

The design pattern

Relieve is based on a design pattern containing:

  • A Worker
  • One or more tasks

The task can be used without a Worker, but the Worker helps managing workflows.


The task will implement a child process using fork. It'll make sure that there is an ipc channel open so that Workers and Tasks can communicate. There are different tasks implementations:

  • Fork Task - simply transforms a ChildProcess.fork in a Task
  • Script Task - wraps a script path in a container that is managed through ChildProcess.fork. It gives the ability to start, restart or kill a Task
  • Callable Task - this is a Script Task with convenience methods to call or get script methods remotely



Different kind of Workers for different use cases. Every Worker takes one or more tasks and handles them.

  • Worker - it's a basic worker. Helps sending a message to every task.
  • QueueWorker - process tasks one after the other, or in concurrency. Waits for a Task to exit before it consider's it as done.
  • CloudWorker - does not wait for tasks to exit and process them through a Strategy (ie: RoundRobin)



  • Containers - easy way to add ipc methods for your tasks
  • Interfaces - extends how the tasks are managed (FailSafe, Logger)