Tutorial: 2-ScriptTask

2-ScriptTask

A Script Task handles the fork and only takes a nodejs script path.

This script will then run in a ScriptContainer. The container is used to pre-register some events and fires:

  • start when the container is ready
  • error when uncaughtException occurs

For example using a small http server:

//server.js
var http = require('http')

http.createServer(function(req, res) {
  res.writeHead(200)
  res.end("hello world\n")
}).listen(8020)

The worker:

//worker.js
var ScriptTask = require('relieve/tasks/ScriptTask')

var task = new ScriptTask('server.js', {restart: true})

task.start()

The Callable Task enables advance interactions. It extends the Script Task.