1.1.1 • Published 9 years ago

sequelize-xa-plugin v1.1.1

Weekly downloads
1
License
ISC
Repository
-
Last release
9 years ago

sequelize-XA-plugin

sequelize XA plugin

support sequelize for xa distribute protocol

Usage

  1. Prepare Environment,support postgres only,edit postgresql.conf set max_prepared_transactions = 10

  2. Init sequelize

    let xaPlugin = require('sequelize-xa-plugin');
    let sequelize = new Sequelize('database', 'user', 'pwd', {
      dialect: 'postgres',
      host: 'localhost',
      port: 5432,
      timezone: '+00:00',
      logging: undefined,
      pool: {
          maxConnections: 10
      }
    });
    sequelize = xaPlugin(sequelize);
  3. XATransaction function

    yield db.XATransaction({
        transactionManager: 'TM URL',
        xid: 'TM ID',
        name: 'child service name',
        callback: 'child transaction callback',
        isolationLevel: Sequelize.Transaction.ISOLATION_LEVELS.READ_UNCOMMITTED
      }, function(t) {
        return co(function*() {
          //...do something to database
        });
      });
  4. XA callback to commit or roolback prepared transaction

    yield sequelize.finishPrepared(transactionId, action);
1.1.1

9 years ago

1.1.0

9 years ago

1.0.9

9 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago