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

@xtreamr/ds_rabbitmq

Package Overview
Dependencies
Maintainers
10
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xtreamr/ds_rabbitmq - npm Package Compare versions

Comparing version 2.0.14 to 2.0.15

2

package.json
{
"name": "@xtreamr/ds_rabbitmq",
"version": "2.0.14",
"version": "2.0.15",
"description": "RabbitMQ queues",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,11 +7,13 @@ 'use strict';

const logger = require("@xtreamr/logger")(module)
let connection
function connectRabbitMQ(config, callback) {
function connectRabbitMQ(config) {
return amqplib
.connect(config.messageQueue)
.then(async (conn) => {
.then((conn) => {
conn.on("close", function () {
logger.error("Reconnecting AMQP Server");
connection = null
return setTimeout(function () {
connectRabbitMQ(config, callback);
connectRabbitMQ(config);
}, config.rabbitmq.attemptTime);

@@ -23,10 +25,34 @@ });

}
connection = null
return setTimeout(function () {
connectRabbitMQ(config, callback);
connectRabbitMQ(config);
}, config.rabbitmq.attemptTime);
});
logger.info(
`Connected to AMQP server as ${config.messageQueue.username}@${config.messageQueue.hostname}${config.messageQueue.vhost}`,
);
if (conn && !connection) {
logger.info(
`Connected to AMQP server as ${config.messageQueue.username}@${config.messageQueue.hostname}${config.messageQueue.vhost}`,
);
if (config.rabbitmq.queues && config.rabbitmq.queues.sendAndForget) {
config.rabbitmq.queues.sendAndForget.forEach((queue) => {
require(name).sendAndForget(queue, config);
});
}
if (config.rabbitmq.queues && config.rabbitmq.queues.rpc) {
config.rabbitmq.queues.rpc.forEach((queue) => {
require(name).rpc(queue, config);
});
}
if (fs.existsSync(process.cwd() + "/frontend")) {
require(process.cwd() + "/frontend").start();
logger.info('Modules loaded')
} else if(config.rabbitmq && config.rabbitmq.consumerPath) {
require(config.rabbitmq.consumerPath).start()
logger.info('Modules loaded')
}
}
connection = conn
return conn

@@ -36,4 +62,5 @@ })

logger.error(`AMQP ${err.message} ${err.stack}`);
connection = null
return setTimeout(function () {
connectRabbitMQ(config, callback);
connectRabbitMQ(config);
}, config.rabbitmq.attemptTime);

@@ -43,28 +70,5 @@ });

function connectPromise(config, callback) {
return connectRabbitMQ(config, callback)
.then(() => {
if (config.rabbitmq.queues && config.rabbitmq.queues.sendAndForget) {
config.rabbitmq.queues.sendAndForget.forEach((queue) => {
require(name).sendAndForget(queue, config);
});
}
if (config.rabbitmq.queues && config.rabbitmq.queues.rpc) {
config.rabbitmq.queues.rpc.forEach((queue) => {
require(name).rpc(queue, config);
});
}
if (fs.existsSync(process.cwd() + "/frontend")) {
require(process.cwd() + "/frontend").start();
} else if(config.rabbitmq && config.rabbitmq.restart) {
require(config.rabbitmq.restart).start()
logger.info('Modules loaded')
}
if (callback !== undefined) {
callback();
} else {
return Promise.resolve();
}
})
function connectPromise(config) {
return connectRabbitMQ(config)
.then(() => Promise.resolve())
}

@@ -71,0 +75,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