
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
simple-queue-decorator
Advanced tools
by @foundernest
Simple decorator-based wrapper for easy RabbitMQ queuing.
Both JavaScript and Typescript can be used, however, this library takes advantage of Typescript decorators. OnQueue decorator is only available using Typescript.
A running instance of RabbitMQ is needed, a docker-compose file is provided to use along with this library in a dev env (
docker-compose up -d rabbitmq). Do not use the given image in production
Init the service:
import * as SimpleQueueDecorator from 'simple-queue-decorator'
await SimpleQueueDecorator.initService({
url: "127.0.0.1",
user: "guest",
password: "guest"
})
await SimpleQueueDecorator.closeService(); // Closes the service
Consume Messages (this can be done before initService):
import { OnQueue } from 'simple-queue-decorator'
class MyConsumer {
@OnQueue('my-queue')
public static async onMessageReceived(msg: any) {
console.log("Message Received", msg.foo)
await doSomethingWithMyMsg(msg) // If this returns a rejected promise, message will be re-queued once
}
}
It is recommended to use static methods with queue decorator
Send Messages (Service must be initiated beforehand):
import * as SimpleQueueDecorator from 'simple-queue-decorator'
SimpleQueueDecorator.sendMessage('my-queue', {foo: "my message name"})
Messages can also be listened without using the decorator:
import * as SimpleQueueDecorator from 'simple-queue-decorator'
SimpleQueueDecorator.registerQueue("my-queue", async (msg) => {
console.log("Message Received", msg.foo)
await doSomethingWithMyMsg(msg)
})
This is preferable if using JavaScript or using dynamic dependencies (e.g. injectables) in the queue callback.
The following options can be passed to initService:
node and npm required, either docker or a running instance of rabbitmq required.
npm installnpm run tsc to compiledocker-compose up -d rabbitmq to launch rabbitmqnpm test to compile and execute testsThis library makes several assumptions on how the messages are going to be consumed, as such, if your needs are different, we recommend directly using amqplib.
FAQs
A simple interface with RabbitMQ through typescript decorators
The npm package simple-queue-decorator receives a total of 4 weekly downloads. As such, simple-queue-decorator popularity was classified as not popular.
We found that simple-queue-decorator 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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.