Skip to content

A Distributed Transaction Library based (Saga pattern)

License

Notifications You must be signed in to change notification settings

nkschmidt/simple-saga

Repository files navigation

Saga Pattern for distributed transactions

Implementation of SAGA pattern in JavaScript.

Installation

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

How to use it

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 });

About

A Distributed Transaction Library based (Saga pattern)

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published