1.1.1 • Published 8 years ago

sequelize-xa-plugin v1.1.1

Weekly downloads
1
License
ISC
Repository
-
Last release
8 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

8 years ago

1.1.0

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago