@aqm/queuelogger
CFWare AQM queue_log mysql writer
Install @aqm/queuelogger
This module requires node.js 12 or above.
npm i --save @aqm/queuelogger
Usage
import {QueueLogger} from '@aqm/queuelogger';
class QueueManager {
constructor() {
this.logger = new QueueLogger({
partition: 'P001',
serverID: 'serverid',
tableName: 'queue_log',
mysql: {},
});
process.on('SIGTERM', () => this.logger.end().catch(() => {}));
}
async writeQueueLog(timeID, callID, queue, agent, verb, data1, data2, data3, data4, data5) {
try {
await this.logger.writeEntry(timeID, callID, queue, agent, verb, data1, data2, data3, data4, data5);
} catch (err) {
}
}
}
Running tests
Tests are provided by eslint and mocha. Tests require access to a test mysql or
mariadb daemon. The test database server must have a queuemetrics
database and
a queuelogd
user as defined by sampledb/qm.sql
.
Default test configuration:
npm config set @aqm/queuelogger:dbhost 'localhost'
npm config set @aqm/queuelogger:dbprivuser 'root'
npm config set @aqm/queuelogger:dbprivpassword ''
These settings can be changed to use a different server or to use an account less
privileged than root. The priv
account must have SELECT and DELETE access to
the queuemetrics.queue_log
table.
Once the database is created and a privileged account configured the tests can be run:
npm install
npm test