Skip to content

Commit c1e9562

Browse files
committed
fix: pass correct config options to broker queue init
1 parent 4c63f64 commit c1e9562

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/broker.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ if (config.get('env') !== 'test') {
3535
* that can be called when a message is received
3636
*/
3737
const Broker = function (queueHandler) {
38-
this.opts = config.get('broker')
38+
this.brokerOpts = config.get('broker')
39+
this.queueOpts = config.get('queue')
3940
this.queueHandler = queueHandler
40-
this.rsmq = this.initialiseQueue(this.opts)
41-
this.throttle = this.initialiseThrottle(this.opts)
41+
this.rsmq = this.initialiseQueue(this.brokerOpts, this.queueOpts)
42+
this.throttle = this.initialiseThrottle(this.brokerOpts)
4243

4344
// message received
4445
this.rsmq.on('message', (msg, next) => {
@@ -60,8 +61,8 @@ const Broker = function (queueHandler) {
6061
message: msg.message,
6162
address: [],
6263
data: null,
63-
retries: this.opts.retries - msg.rc,
64-
timeout: now + this.opts.timeout,
64+
retries: this.brokerOpts.retries - msg.rc,
65+
timeout: now + this.brokerOpts.timeout,
6566
age: now + msg.sent,
6667
sent: msg.sent
6768
}
@@ -136,9 +137,9 @@ Broker.prototype.processResponse = function (req, err) {
136137
* @param {object} options - the set of configuration options loaded from the configuration file
137138
* @returns {object} - the RSMQ instance
138139
*/
139-
Broker.prototype.initialiseQueue = function (options) {
140+
Broker.prototype.initialiseQueue = function (brokerOpts, queueOpts) {
140141
/* istanbul ignore next */
141-
return new Rsmq(options.broker.queue, options.queue)
142+
return new Rsmq(brokerOpts.queue, queueOpts)
142143
}
143144

144145
/**

0 commit comments

Comments
 (0)