Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

amqp.channel

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amqp.channel - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

33

channel.js
var noop = function(){},
Promise = require('bluebird');
amqp = require('amqplib'),
Promise = require('bluebird');

@@ -8,3 +9,3 @@ module.exports = function createChannel(url, assertions, log){

return require('amqplib').connect(url).then(openChannel, log.error);
return amqp.connect(url).then(openChannel);

@@ -18,12 +19,9 @@ function openChannel(connection) {

process.once('SIGTERM', close);
return connection.createConfirmChannel().then(assertChannelMethods, close);
return connection.createConfirmChannel().then(setupChannel, close);
}
function assertChannelMethods(channel) {
function setupChannel(channel) {
var setup = [];
for (var fn in assertions) {
setup.push.apply(setup, assertions[fn].map(function invocation(args){
log.info('- Channel %s(%j)', fn, args);
return channel[fn].apply(channel, args);
}));
for (var method in assertions) {
setup.push.apply(setup, assertions[method].map(applyToChannel(method)));
};

@@ -36,6 +34,11 @@

return Promise.all(setup)
.then(returnChannel)
.catch(closeChannel);
return Promise.all(setup).then(returnChannel, closeChannel);
function applyToChannel(method){
return function invocation(args){
log.info('- Channel %s(%j)', method, args);
return channel[method].apply(channel, args);
}
}
function returnChannel(){

@@ -49,9 +52,9 @@ log.info('- Channel setup complete');

channel.close();
throw error;
return Promise.reject(error);
}
function blocked(isBlocked){
var state = isBlocked ? 'blocked' : 'unblocked';
var level = isBlocked ? 'warn' : 'info';
return function changeState(){
var state = isBlocked ? 'blocked' : 'unblocked';
var level = isBlocked ? 'warn' : 'info';
log[level]('- Channel %s', state);

@@ -58,0 +61,0 @@ channel.isBlocked = isBlocked;

{
"name": "amqp.channel",
"version": "0.0.8",
"version": "0.0.9",
"description": "A simplified way to setup an AMQP connection/channel with amqplib",
"main": "channel.js",
"dependencies": {
"amqplib": "^0.3.0",
"bluebird": "^2.3.2"
"amqplib": "^0.3.1",
"bluebird": "^2.9.13"
},

@@ -10,0 +10,0 @@ "devDependencies": {

@@ -161,3 +161,3 @@ /*jslint nodejs: true, expr: true*/

getChannel = stubChannel(amqpUrl, assertions, npmlog);
getChannel.then(test).catch(test);
getChannel.then(test, test);
});

@@ -164,0 +164,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc