Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@pager/jackrabbit
Advanced tools
This is a fork of hunterloftis/jackrabbit.
Jackrabbit is a very opinionated abstraction built on top of amqplib
focused
on usability and implementing several messaging patterns on RabbitMQ.
// producer.js
'use strict';
const jackrabbit = require('@pager/jackrabbit');
const rabbit = jackrabbit(process.env.RABBIT_URL);
rabbit
.default()
.publish('Hello World!', { key: 'hello' })
.on('drain', rabbit.close);
// consumer.js
'use strict';
const jackrabbit = require('@pager/jackrabbit');
const rabbit = jackrabbit(process.env.RABBIT_URL);
rabbit
.default()
.queue({ name: 'hello' })
.consume(onMessage, { noAck: true });
function onMessage(data) {
console.log('received:', data);
}
'use strict';
const jackrabbit = require('@pager/jackrabbit');
const rabbit = jackrabbit(process.env.RABBIT_URL);
rabbit
.default()
.queue({ name: 'important_job' })
.consume(function(data, ack, nack, msg) {
// process data...
// and ACK on success
ack();
// or alternatively NACK on failure
nack();
})
For now, the best usage help is can be found in examples, which map 1-to-1 with the official RabbitMQ tutorials.
npm install --save @pager/jackrabbit
The tests are set up with Docker + Docker-Compose, so you don't need to install rabbitmq (or even node) to run them:
$ docker-compose up
Jackrabbit is a wrapper for ampqlib, ampqlib does NOT support reconnection.
This project will try to recover a lost connection gracefully, if it fails to do so, we will throw an error
event and then exit the current process with code 1
.
Our approach to reconnection is recording all the exchanges and queues created through jackrabbit. Once a connection is lost, we will try to create a new one, update the existing exchange and queue references, initialize a new channel for each queue, and bind each queue's consumers to their new channel. This should be transparent to any users of this lib.
You can configure some basic parameters of the reconnection process with some env vars:
Name | Default | Description |
---|---|---|
RABBIT_RECONNECTION_TIMEOUT | 2000 | ms between each reconnection attempt. The first attempt will always be immediate. |
RABBIT_RECONNECTION_RETRIES | 20 | Amount of retries before erroring out and killing the node process. |
RABBIT_RECONNECTION_EXACT_TIMEOUT | false | To prevent total outages on HA services, we're adding a random overhead of 0-10% to the reconnection timeout by default. You can disable this behaviour by setting this option to true . |
FAQs
Easy RabbitMQ for node
The npm package @pager/jackrabbit receives a total of 3,136 weekly downloads. As such, @pager/jackrabbit popularity was classified as popular.
We found that @pager/jackrabbit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 84 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.