The Digital Telepresence Platform core implementing user account management, authentication, search, global directory, and other platform-wide services. https://digitaltelepresence.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

47 lines
1.4 KiB

// site-worker-process.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const path = require('path');
const { SiteCommon } = require(path.join(__dirname, 'site-common'));
/**
* Your actual worker processor will extend SiteWorkerProcess and implement the
* expected interface including the.
*
* Your derived class must implement a static getter for COMPONENT as follows:
*
* ```
* static get COMPONENT ( ) { return { logId: '', name: '', className: '' }; }
* ```
*
* It must pass that object to this constructor (super) along with the worker
* reference you are given at your constructor.
*
* Your worker logic script can then be a fully-managed process within the DTP
* ecosystem.
*/
class SiteWorkerProcess extends SiteCommon {
constructor (worker, component) {
super(worker.dtp, component);
this.worker = worker;
}
/**
* Utility/convenience method that logs a message to both a Bull Queue job log
* and also DTP's logging infrastructure for the worker process.
* @param {Job} job Bull queue job for which a log is written
* @param {*} message The message to be written
* @param {*} data An object containing any data to be logged
*/
async jobLog (job, message, data = { }) {
job.log(message);
this.log.info(message, { jobId: job.id, ...data });
}
}
module.exports.SiteWorkerProcess = SiteWorkerProcess;