
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
amqp-delegate
Advanced tools
A very simplistic, but performant, remote worker system that uses AMQP to coordinate jobs.
A very simplistic, but performant, remote worker system that uses AMQP to coordinate jobs.
branch | status | coverage | notes |
---|---|---|---|
develop | Work in progress | ||
master | Latest stable release |
amqp-simple-pub-sub
— A library that simplifies use of aqmp based publishers and subscribers.npm install amqp-delegate
const { makeWorker } = require('amqp-delegate')
const worker = makeWorker({
url: <the url of the amqp server> - defaults to ampq://localhost,
name: <the name of the worker> — required,
task: <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: <the url of the amqp server> - defaults to ampq://localhost,
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
}
})
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)
})
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 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 1 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.