Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
rabbitmq-queue-stream
Advanced tools
$ make test
$ npm i rabbitmq-queue-stream
var RabbitMQStream = require("rabbitmq-queue-stream");
var Transform = require("stream").Transform;
var options = {
connection: {
url: "amqp://user:password@rabbitmq.com"
},
queueStream: {
name: "myQueue",
prefetchCount: 100
}
};
/*
* Initialize two consumer channels to our queue.
*/
RabbitMQStream.init(2, options, function(err, streamifiedQueues) {
if(err) {
return console.error(err);
}
var queueStreams = streamifiedQueues.sources;
/*
* Each consumer channel comes with a .source and .sink property.
*
* .source is a Readable stream that gives us a stream of objects
* from the specified queue
*
* Every job written to .sink is deleted from the queue. Only object
* originating from .source should be written to .sink
*
*/
streamifiedQueues.sources.forEach(function(myQueueStream) {
var doSomethingWithData = new Transform({objectMode: true});
doSomethingWithData._transform(function(data, enc, next) {
console.log("Doing something with", data);
this.push(data);
next();
});
myQueueStream.source
.pipe(doSomethingWithData)
.pipe(myQueueStream.sink);
});
/* example graceful shutdown routine */
var gracefulShutdown = function() {
//stop fetching messages
streamifiedQueues.unsubscribeConsumers(function(err) {
if(err) {
//handle error
}
//Wait some time for queues to flush out. Then close Consumers
streamifiedQueues.closeConsumers(function(err) {
if(err) {
//handle error
}
streamifiedQueues.disconnect(function(err) {
if(err) {
//handle error
}
process.exit(0);
});
});
});
};
});
myQueueStream.source.on("parseError", function(err, message) {
console.error("Problem JSON parsing message", message);
});
var totalDeleted = 0;
myQueueStream.source.on("deleted", function() {
console.log("Deleted", totalDeleted++);
});
myQueueStream.sink.on("formatError", function(err, message) {
console.error("Malformatted message written to .sink. Please check your pipeline configuration", message);
});
FAQs
Reliable streaming interface to rabbitmq queues
The npm package rabbitmq-queue-stream receives a total of 2 weekly downloads. As such, rabbitmq-queue-stream popularity was classified as not popular.
We found that rabbitmq-queue-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.