Implementation of SAGA pattern in JavaScript.
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. Node.js 0.12 or higher is required.
Installation is done using the
npm install
command:
$ npm install simple-saga
var saga = new Saga({});
saga
.addTask({ id: "createOrder", transaction: fn1, compensation: cp1 })
.addParallelTasks(
{ id: "bookAuto", transaction: fn2 },
{ id: "buyTicket", transaction: fn3, compensation: cp3 }
)
.addTask({ id: "reserveHotel", transaction: fn4, compensation: cp4 });
saga.run({ startAt: dateStart, endAt: dateEnd });