New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

larvitamintercom

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvitamintercom - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

42

index.js
'use strict';
const EventEmitter = require('events').EventEmitter,
uuidLib = require('node-uuid'),
uuidLib = require('uuid'),
bramqp = require('bramqp'),

@@ -183,3 +183,5 @@ lUtils = require('larvitutils'),

if (options.exchange === undefined) { options.exchange = 'default'; }
if (options.exchange === undefined) {
options.exchange = 'default';
}

@@ -325,3 +327,3 @@ queueName = 'queTo_' + options.exchange;

passive = false, // https://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare.passive
durable = true, // https://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare.durable
durable = (options.durable === undefined) ? true : options.durable, // https://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare.durable
noWait = false, // "If set, the server will not respond to the method. The client should not

@@ -336,3 +338,3 @@ // wait for a reply method. If the server could not complete the method it will

log.verbose('larvitamintercom: declareQueue() - Declaring. queueName: "' + options.queueName + '" exclusive: ' + options.exclusive.toString());
log.verbose('larvitamintercom: declareQueue() - Declaring queueName: "' + options.queueName + '" exclusive: ' + options.exclusive.toString());

@@ -355,4 +357,8 @@ that.handle.queue.declare(that.channelName, options.queueName, passive, durable, options.exclusive, autoDelete, noWait, args, function(err) {

*
* @param obj message - message will be appended with an uuid if that does not exist
* @param obj options - OPTIONAL - options.exchange = str
* @param obj message - message will be appended with an uuid if that does not exist
* @param obj options - { OPTIONAL
* 'exchange': str, // Default: "default"
* 'durable': boolean, // Default: true
* 'forceConsumeQueue': boolean, // Default: false - will create a consume-queue even if there currently are no listeners
* }
* @param func cb(err, message assigned uuid)

@@ -372,3 +378,5 @@ */

if (options.exchange === undefined) { options.exchange = 'default'; }
if (options.exchange === undefined) {
options.exchange = 'default';
}

@@ -413,2 +421,16 @@ that.sendQueue.push({'orgMsg': orgMsg, 'options': options, 'cb': cb});

if (options.forceConsumeQueue === true) {
const queueName = 'queTo_' + options.exchange;
// Declare queue
tasks.push(function(cb) {
that.declareQueue({'queueName': queueName}, cb);
});
// Bind queue
tasks.push(function(cb) {
that.bindQueue(queueName, options.exchange, cb);
});
}
// Publish

@@ -484,5 +506,7 @@ tasks.push(function(cb) {

if (options.exchange === undefined) { options.exchange = 'default'; }
if (options.exchange === undefined) {
options.exchange = 'default';
}
log.verbose('larvitamintercom: consume() - Starting on exchange "' + options.exchange + '"');
log.verbose('larvitamintercom: subscribe() - Starting on exchange "' + options.exchange + '"');

@@ -489,0 +513,0 @@ // Declare exchange

{
"name": "larvitamintercom",
"version": "0.1.2",
"version": "0.1.3",
"description": "",

@@ -14,2 +14,9 @@ "main": "index.js",

"author": "Gagge <tobias@nublar.se>",
"contributors": [
{
"name": "Lillem4n",
"email": "lilleman@larvit.se",
"url": "larvit.se"
}
],
"license": "ISC",

@@ -23,4 +30,4 @@ "bugs": {

"bramqp": "^0.5.0",
"larvitutils": "^1.0.4",
"node-uuid": "^1.4.7",
"larvitutils": "^1.1.0",
"uuid": "^3.0.0",
"winston": "^2.2.0"

@@ -27,0 +34,0 @@ },

@@ -32,3 +32,4 @@ [![Build Status](https://travis-ci.org/larvit/larvitamintercom.svg?branch=master)](https://travis-ci.org/larvit/larvitamintercom) [![Dependencies](https://david-dm.org/larvit/larvitamintercom.svg)](https://david-dm.org/larvit/larvitamintercom.svg)

'exchange': 'default',
'durable': true
'durable': true,
'forceConsumeQueue': false // Will create a queue for consumtion even if there is no current listeners. This way no message will ever be lost, since they will wait in this queue until some consumer consumes them.
}

@@ -35,0 +36,0 @@ ```

@@ -338,2 +338,28 @@ 'use strict';

});
it('send before consumer is up and still receive', function(done) {
const exchange = 'dkfia893M', // Random exchange to not collide with another test
orgMsg = {'foo': 'bar'};
this.timeout(500);
this.slow(420); // > 1050 is shown in yellow, 1000ms is setTimeout()
intercoms[0].send(orgMsg, {'exchange': exchange, 'forceConsumeQueue': true}, function(err) {
if (err) throw err;
setTimeout(function() {
intercoms[0].consume({'exchange': exchange}, function(msg, ack, deliveryTag) {
assert.notDeepEqual(lUtils.formatUuid(msg.uuid), false);
delete msg.uuid;
assert.deepEqual(JSON.stringify(orgMsg), JSON.stringify(msg));
assert(deliveryTag, 'deliveryTag shoult be non-empty');
ack();
done();
}, function(err) {
if (err) throw err;
});
}, 200);
});
});
});

Sorry, the diff of this file is not supported yet

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