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.
redis-streams-broker
Advanced tools
This package is a broker to redis stream data type, This package provides guaranteed message delivery feature with acknowledgement.
This simple package is based on redis streams data type which provides you with following features
npm -i redis-streams-broker
const brokerType = require('redis-streams-broker').StreamChannelBroker;
docker run --name streamz -p 6379:6379 -itd --rm redis:latest
const broker = new brokerType(redisConnectionString, name);
const redisConnectionString = "redis://127.0.0.1:6379/";
const qName = "Queue";
const brokerType = require('redis-streams-broker').StreamChannelBroker;
const broker = new brokerType(redisConnectionString, qName);
//Used to publish a paylod on stream.
const payloadId = await broker.publish({ a: "Hello", b: "World" });
//Creates a consumer group to receive payload
const consumerGroup = await broker.joinConsumerGroup("MyGroup");
//Registers a new consumer with Name and Callback for message handlling.
const subscriptionHandle = await consumerGroup.subscribe("Consumer1", newMessageHandler);
// Handler for arriving Payload
async function newMessageHandler(payload) {
for (let index = 0; index < payload.length; index++) {
try {
const element = payload[index];
console.log("Payload Id:", element.id); //Payload Id
console.log("Payload Received from :", element.channel); //Stream name
console.log("Actual Payload:", element.payload); //Actual Payload
await element.markAsRead(); //Payload is marked as delivered or Acked also optionaly the message can be dropped.
}
catch (exception) {
console.error(exception);
}
}
}
//Provides summary of payloads which have delivered but not acked yet.
const summary = await consumerGroup.pendingSummary();
//Unsubscribes the consumer from the group.
const sucess = consumerGroup.unsubscribe(subscriptionHandle);
//Amount of memory consumed by this stream in bytes.
const consumedMem = await broker.memoryFootprint();
0.0.7[Beta]
This project is contrubution to public domain and completely free for use, view LICENSE.md file for details.
FAQs
This package is a broker to redis stream data type, This package provides guaranteed message delivery feature with acknowledgement.
We found that redis-streams-broker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.