pg-logical-replication
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "pg-logical-replication", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "PostgreSQL Location Replication client - logical WAL replication streaming", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -68,8 +68,18 @@ # pg-logical-replication | ||
```javascript | ||
var LogicalReplication = require('../index.js'); | ||
/* | ||
* Test progress | ||
* 1. Create logical replication slot with test_decoding output plugin : SELECT * FROM pg_create_logical_replication_slot('test_slot', 'test_decoding'); | ||
* 2. Launch nodejs with this file : node test.js | ||
* 3. Modify data of database | ||
*/ | ||
var LogicalReplication = require('pg-logical-replication'); | ||
var PluginTestDecoding = LogicalReplication.LoadPlugin('output/test_decoding'); | ||
var lastLsn = null; // or initialize LSN | ||
//Connection parameter : https://github.com/brianc/node-postgres/wiki/Client#parameters | ||
var connInfo = {}; | ||
var stream = (new LogicalReplication({})) | ||
//Initialize with last LSN value | ||
var lastLsn = null; | ||
var stream = (new LogicalReplication(connInfo)) | ||
.on('data', function(msg) { | ||
@@ -81,8 +91,8 @@ lastLsn = msg.lsn || lastLsn; | ||
console.log(PluginTestDecoding.parse(log)); | ||
//DO SOMETHING. eg) replicate to other dbms(pgsql, mysql, ...) | ||
//TODO: DO SOMETHING. eg) replicate to other dbms(pgsql, mysql, ...) | ||
} catch (e) { | ||
console.log(log, e); | ||
console.trace(log, e); | ||
} | ||
}).on('error', function(err) { | ||
console.log('Error #2', err); | ||
console.trace('Error #2', err); | ||
setTimeout(proc, 1000); | ||
@@ -98,3 +108,3 @@ }); | ||
if (err) { | ||
console.log('Logical replication initialize error', err); | ||
console.trace('Logical replication initialize error', err); | ||
setTimeout(proc, 1000); | ||
@@ -101,0 +111,0 @@ } |
@@ -7,3 +7,3 @@ /* | ||
*/ | ||
var LogicalReplication = require('../index.js'); //TODO: replace | ||
var LogicalReplication = require('../index.js'); //TODO: replace to 'pg-logical-replication' | ||
var PluginTestDecoding = LogicalReplication.LoadPlugin('output/test_decoding'); | ||
@@ -10,0 +10,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44758
122