This commit is contained in:
parent
4283a37bbf
commit
7ae4f09453
|
@ -1,4 +1,4 @@
|
||||||
# MyCDC
|
# MyCDC - MySQL change data capture
|
||||||
|
|
||||||
Application to run asynchronous operations based on DB changes. It is divided
|
Application to run asynchronous operations based on DB changes. It is divided
|
||||||
into three services:
|
into three services:
|
||||||
|
@ -10,7 +10,7 @@ relevant messages to each RabbitMQ queue.
|
||||||
- Consumer: Obtains the elements from the queues and performs the necessary
|
- Consumer: Obtains the elements from the queues and performs the necessary
|
||||||
operations asynchronously.
|
operations asynchronously.
|
||||||
|
|
||||||
## Enviroment setup
|
## Environment setup
|
||||||
|
|
||||||
Because a bug with MariaDB wich it's fix is pending to be merged into main
|
Because a bug with MariaDB wich it's fix is pending to be merged into main
|
||||||
project branch, a *zongji* fork must be cloned into project root directory.
|
project branch, a *zongji* fork must be cloned into project root directory.
|
||||||
|
@ -49,3 +49,4 @@ npm run consumer
|
||||||
|
|
||||||
* [Zongji](https://github.com/nevill/zongji)
|
* [Zongji](https://github.com/nevill/zongji)
|
||||||
* [MySQL2](https://github.com/sidorares/node-mysql2#readme)
|
* [MySQL2](https://github.com/sidorares/node-mysql2#readme)
|
||||||
|
* [RabbitMQ] (https://www.rabbitmq.com/)
|
||||||
|
|
|
@ -30,13 +30,13 @@ module.exports = class QueueFk extends Queue {
|
||||||
if (this.nMessages) {
|
if (this.nMessages) {
|
||||||
const {consumer} = this;
|
const {consumer} = this;
|
||||||
|
|
||||||
if (consumer.conf.debug)
|
|
||||||
console.debug('Flush:'.blue, this.name.yellow, this.ids);
|
|
||||||
|
|
||||||
const scopes = this.scopes;
|
const scopes = this.scopes;
|
||||||
const lastMessage = this.lastMessage;
|
const lastMessage = this.lastMessage;
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
|
if (consumer.conf.debug)
|
||||||
|
console.debug('Flush:'.blue, this.name.yellow, scopes);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (const [scope, ids] of scopes) {
|
for (const [scope, ids] of scopes) {
|
||||||
let query = this.conf.query[scope];
|
let query = this.conf.query[scope];
|
||||||
|
|
5
mycdc.js
5
mycdc.js
|
@ -318,7 +318,10 @@ module.exports = class MyCDC {
|
||||||
case 'rotate':
|
case 'rotate':
|
||||||
this.filename = evt.binlogName;
|
this.filename = evt.binlogName;
|
||||||
position = evt.position;
|
position = evt.position;
|
||||||
console.log(`[${eventName}] filename: ${this.filename}`, `position: ${this.position}, nextPosition: ${evt.nextPosition}`);
|
console.log(
|
||||||
|
`[${eventName}] filename: ${this.filename}`,
|
||||||
|
`position: ${this.position}, nextPosition: ${evt.nextPosition}`
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 'writerows':
|
case 'writerows':
|
||||||
case 'deleterows':
|
case 'deleterows':
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mycdc",
|
"name": "mycdc",
|
||||||
"version": "0.0.9",
|
"version": "0.0.10",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Asynchronous DB calculations reading the binary log",
|
"description": "Asynchronous DB calculations reading the binary log",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
query:
|
query:
|
||||||
ticket: CALL vn.ticket_recalc(:id, NULL)
|
ticket: CALL vn.ticket_recalc(:id, NULL)
|
||||||
client: CALL vn.ticket_recalcByScope(:table, :id)
|
client: CALL vn.ticket_recalcByScope('client', :id)
|
||||||
address: CALL vn.ticket_recalcByScope(:table, :id)
|
address: CALL vn.ticket_recalcByScope('address', :id)
|
||||||
includeSchema:
|
includeSchema:
|
||||||
vn:
|
vn:
|
||||||
ticket:
|
ticket:
|
||||||
|
|
|
@ -6,4 +6,4 @@ includeSchema:
|
||||||
key: travelFk
|
key: travelFk
|
||||||
scope: travel
|
scope: travel
|
||||||
columns:
|
columns:
|
||||||
- travelfk
|
- travelFk
|
||||||
|
|
Loading…
Reference in New Issue