X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fbase.js;h=0805d07dff2b4ccf4f30a03e404f8a1bb1eba0d7;hb=b27af23673b86d25c29a82d3774c7a3b046004cb;hp=87607daeb6e7c1402feb490c5a0fc5c513ea6f1a;hpb=5f75c488a2d6a7149d83f4dffb918f1eb101b053;p=squeep-amqp-helper diff --git a/lib/base.js b/lib/base.js index 87607da..0805d07 100644 --- a/lib/base.js +++ b/lib/base.js @@ -1,9 +1,9 @@ 'use strict'; const amqp = require('amqplib'); const { isFatalError: isFatalAMQPError } = require('amqplib/lib/connection'); -const common = require('./common'); +const { fileScope } = require('@squeep/log-helper'); -const _fileScope = common.fileScope(__filename); +const _fileScope = fileScope(__filename); /** * Base class common to worker publisher and consumer, handling @@ -25,7 +25,7 @@ class Base { */ constructor(logger, options) { this.logger = logger; - this.options = Object.assign({ + this.options = { url: undefined, name: 'messages', prefix: 'squeep', @@ -35,14 +35,16 @@ class Base { queueType: 'quorum', retryDelayMs: 10000, prefetch: 1, - }, options); - this.options.socketOptions = Object.assign({ + ...options, + }; + this.options.socketOptions = { noDelay: undefined, timeout: undefined, keepAlive: undefined, keepAliveDelay: undefined, clientProperties: undefined, - }, options.socketOptions); + ...options.socketOptions, + }; this.connection = undefined; this.channel = undefined; @@ -50,7 +52,7 @@ class Base { /** - * Establish the necessary connections to the queue and lock services. + * Establish the necessary connections to the queue. */ async connect() { const _scope = _fileScope('connect');