function publishObject(channel, message) { return publisher.publish(channel, JSON.stringify(message)) }
AV.Cloud.define('publishMessage', async request => { return redisClient.publish('messages', JSON.stringify(request.params)) })
_sendRequest(site, msg) { const channel = `${this._topic}-${site}`; this.publisher.publish(channel, msg); }
/** * Pause operations for given site(s) * @param {Object} details - The route details * @param {String} body - The POST request body string * @param {Function} cb - The callback to call * @return {undefined} */ pauseService(details, body, cb) { const service = details.service; let sites; if (details.site === 'all') { sites = details.extensions[service].filter(s => s !== 'all'); } else { sites = [details.site]; } sites.forEach(site => { // TODO: assumption that site is available on processor side const topic = service === 'crr' ? this._crrTopic : this._ingestionTopic; const channel = `${topic}-${site}`; const message = JSON.stringify({ action: 'pauseService' }); this._redisPublisher.publish(channel, message); }); this._logger.info(`${service} service paused for locations: ${sites}`); return cb(null, {}); }
webSocket.on("handled", data => { pub.publish(roomId, data); });
date: schedule, }); this._redisPublisher.publish(channel, message); }); if (schedule) {
/** * Remove scheduled resume for given site(s) * @param {Object} details - The route details * @param {Function} cb - The callback to call * @return {undefined} */ deleteScheduledResumeService(details, cb) { const service = details.service; let sites; if (details.site === 'all') { sites = details.extensions[service].filter(s => s !== 'all'); } else { sites = [details.site]; } sites.forEach(site => { const topic = service === 'crr' ? this._crrTopic : this._ingestionTopic; const channel = `${topic}-${site}`; const message = JSON.stringify({ action: 'deleteScheduledResumeService', }); this._redisPublisher.publish(channel, message); }); this._logger.info(`deleted scheduled resume for locations: ${sites}`); return cb(null, {}); }