Comparing version 14.0.1 to 14.1.0
# Change Log | ||
## 14.1.0 | ||
- Adds support for custom user agents - See https://github.com/guidesmiths/rascal/issues/170 | ||
## 14.0.1 | ||
@@ -4,0 +8,0 @@ |
@@ -21,5 +21,12 @@ const debug = require('debug')('rascal:Broker'); | ||
if (arguments.length === 2) return create(config, {}, arguments[1]); | ||
const counters = _.defaults({}, components.counters, { | ||
stub, | ||
inMemory, | ||
inMemoryCluster, | ||
}); | ||
preflight(_.cloneDeep(config), (err, config) => { | ||
if (err) return next(err); | ||
new Broker(config, components)._init(next); | ||
new Broker(config, _.assign({}, components, { counters }))._init(next); | ||
}); | ||
@@ -43,7 +50,2 @@ }, | ||
const bounceVhost = tasks.bounceVhost; | ||
const counters = _.defaults({}, components.counters, { | ||
stub, | ||
inMemory, | ||
inMemoryCluster, | ||
}); | ||
@@ -59,3 +61,3 @@ this.config = config; | ||
sessions = []; | ||
init(config, { broker: self, components: { counters } }, (err) => { | ||
init(config, { broker: self, components }, (err) => { | ||
self.keepActive = setInterval(_.noop, maxInterval); | ||
@@ -141,3 +143,3 @@ setImmediate(() => { | ||
(vhost, callback) => { | ||
nukeVhost(config, { vhost }, callback); | ||
nukeVhost(config, { vhost, components }, callback); | ||
}, | ||
@@ -144,0 +146,0 @@ (err) => { |
const debug = require('debug')('rascal:tasks:assertVhost'); | ||
const _ = require('lodash'); | ||
const async = require('async'); | ||
const client = require('../../management/client'); | ||
const Client = require('../../management/Client'); | ||
module.exports = _.curry((config, ctx, next) => { | ||
if (!config.assert) return next(null, config, ctx); | ||
const candidates = config.connections; | ||
const client = new Client(ctx.components.agent); | ||
@@ -10,0 +12,0 @@ async.retry( |
const debug = require('debug')('rascal:tasks:checkVhost'); | ||
const _ = require('lodash'); | ||
const async = require('async'); | ||
const client = require('../../management/client'); | ||
const Client = require('../../management/Client'); | ||
module.exports = _.curry((config, ctx, next) => { | ||
if (!config.check) return next(null, config, ctx); | ||
const candidates = config.connections; | ||
const client = new Client(ctx.components.agent); | ||
@@ -10,0 +12,0 @@ async.retry( |
const debug = require('debug')('rascal:tasks:deleteVhost'); | ||
const _ = require('lodash'); | ||
const async = require('async'); | ||
const client = require('../../management/client'); | ||
const Client = require('../../management/Client'); | ||
@@ -11,2 +11,3 @@ module.exports = _.curry((config, ctx, next) => { | ||
const candidates = vhostConfig.connections; | ||
const client = new Client(ctx.components.agent); | ||
@@ -13,0 +14,0 @@ async.retry( |
@@ -12,3 +12,3 @@ const debug = require('debug')('rascal:tasks:initVhosts'); | ||
(vhostConfig, callback) => { | ||
initVhost(vhostConfig, (err, vhost) => { | ||
initVhost(vhostConfig, ctx.components, (err, vhost) => { | ||
if (err) return callback(err); | ||
@@ -28,4 +28,4 @@ vhost.setMaxListeners(0); | ||
function initVhost(config, next) { | ||
Vhost.create(config, next); | ||
function initVhost(config, components, next) { | ||
Vhost.create(config, components, next); | ||
} |
@@ -14,4 +14,4 @@ const debug = require('debug')('rascal:Vhost'); | ||
module.exports = { | ||
create(config, next) { | ||
new Vhost(config).init(next); | ||
create(config, components, next) { | ||
new Vhost(config, components).init(next); | ||
}, | ||
@@ -22,3 +22,3 @@ }; | ||
function Vhost(config) { | ||
function Vhost(config, components) { | ||
const self = this; | ||
@@ -54,3 +54,3 @@ let connection; | ||
init(config, { connectionIndex: self.connectionIndex }, (err, config, ctx) => { | ||
init(config, { connectionIndex: self.connectionIndex, components }, (err, config, ctx) => { | ||
if (err) return next(err); | ||
@@ -57,0 +57,0 @@ |
{ | ||
"name": "rascal", | ||
"version": "14.0.1", | ||
"version": "14.1.0", | ||
"description": "A config driven wrapper for amqplib supporting multi-host connections, automatic error recovery, redelivery flood protection, transparent encryption / decryption, channel pooling and publication timeouts", | ||
@@ -32,2 +32,3 @@ "main": "index.js", | ||
"random-readable": "^1.0.1", | ||
"superagent-defaults": "^0.1.14", | ||
"zunit": "^3.0.8" | ||
@@ -34,0 +35,0 @@ }, |
@@ -486,2 +486,11 @@ # Rascal | ||
You can also supply your own agent via the broker components. Use this when you need to set [TLS options](https://visionmedia.github.io/superagent/#tls-options). | ||
```js | ||
const superagent = require('superagent-defaults'); | ||
const agent = superagent().on('request', (req) => console.log(req.url)); | ||
const components = { agent }; | ||
const broker = await Broker.create(config, components); | ||
``` | ||
#### assert | ||
@@ -488,0 +497,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
217804
3501
1801
13