# sequelize-xa-plugin

> sequelize plugin XA transaction

Latest version **1.1.1** (published 2015-12-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install sequelize-xa-plugin
pnpm add sequelize-xa-plugin
yarn add sequelize-xa-plugin
bun add sequelize-xa-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2015-12-22 |
| First published | 2015-11-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+8 in 3 direct dependencies) |
| Install scripts | no |
| Author | flex1988 |
| Maintainers | flex1988 |
| Keywords | sequelize, plugin, XA, transaction |

## Links

- npm: https://www.npmjs.com/package/sequelize-xa-plugin
- npm.io page: https://npm.io/package/sequelize-xa-plugin

## Dependencies (3)

- [uuid](https://npm.io/package/uuid.md) ^2.0.1
- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [request](https://npm.io/package/request.md) ^2.67.0

## Recent versions

- 1.1.1 (latest) — 2015-12-22
- 1.1.0 — 2015-12-22
- 1.0.9 — 2015-12-18
- 1.0.8 — 2015-12-04
- 1.0.7 — 2015-11-27
- 1.0.6 — 2015-11-26
- 1.0.5 — 2015-11-26
- 1.0.4 — 2015-11-26
- 1.0.3 — 2015-11-26
- 1.0.2 — 2015-11-25
- 1.0.1 — 2015-11-25
- 1.0.0 — 2015-11-25

## README

# 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
  ```javascript
  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

  ```javascript
  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

  ```javascript
  yield sequelize.finishPrepared(transactionId, action);
  ```

---
_Source: https://npm.io/package/sequelize-xa-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
