Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
amqp-delegate
Advanced tools
A remote worker system that uses AMQP
to coordinate jobs.
amqp-simple-pub-sub
— A library that simplifies use of AMQP
based publishers and subscribers.npm install amqp-delegate
const { makeWorker } = require('amqp-delegate')
const worker = makeWorker({
url: 'ampq://localhost:5672', // the default
name: 'the name of the worker', // required
task: async () => 'any pure async function', // required
onError: err => { // optional
console.error('A connection error happened', err) // or do something clever
}
onClose: () => { // optional
console.log('The connection has closed.') // or do something clever
}
})
// start it
worker.start().then(() => {
console.log('worker', worker.name, 'started')
})
// stop it
worker.stop().then(() => {
console.log('worker', worker.name, 'stopped')
})
const { makeDelegator } = require('amqp-delegate')
const delegator = makeWorker({
url: 'ampq://localhost:5672', // the default
onError: err => { // optional
console.error('A connection error happened', err) // or something clever
}
onClose: () => { // optional
console.log('The connection has closed.') // or something clever
}
})
delegator
.start()
.then(() => {
delegator.invoke('worker name', ...params)
console.log('job name', result)
})
.catch(err => {
console.error('worker name', err)
})
const { makeWorker } = require('amqp-delegate')
const task = (a, b) =>
new Promise(resolve => setTimeout(() => resolve(a + b), 10))
const worker = makeWorker({
name: 'adder',
task
})
worker
.start()
.then(() => {
process.on('SIGINT', () => {
worker.stop().then(() => {
process.exit(0)
})
})
})
.catch(err => {
console.error('caught', err)
})
const { makeDelegator } = require('amqp-delegate')
const delegator = makeDelegator()
delegator
.start()
.then(() => delegator.invoke('adder', 10, 15))
.then(result => {
console.log('result', result)
})
.catch(err => {
console.error('caught', err)
})
branch | status | coverage | notes |
---|---|---|---|
develop | Work in progress | ||
master | Latest stable release |
nvm
to manage Node versions — brew install nvm
.)npm install
docker-compose up -d
Runs Rabbit MQ.
npm test
— runs the unit tests (does not need rabbitmq
)npm run test:unit:cov
— runs the unit tests with code coverage (does not need rabbitmq
)npm run test:integration
— runs the integration tests (needs rabbitmq
)npm run test:mutants
— runs the mutation tests (does not need rabbitmq
)npm run lint
Please see the contributing notes.
FAQs
A remote worker system that uses AMQP to coordinate jobs.
The npm package amqp-delegate receives a total of 6 weekly downloads. As such, amqp-delegate popularity was classified as not popular.
We found that amqp-delegate 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.