# rabbitmqueue

> [![Node.js CI](https://github.com/saularis/rabbitmqueue/actions/workflows/node.js.yml/badge.svg)](https://github.com/saularis/rabbitmqueue/actions/workflows/node.js.yml)

Latest version **1.1.1** (published 2023-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install rabbitmqueue
pnpm add rabbitmqueue
yarn add rabbitmqueue
bun add rabbitmqueue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2023-03-12 |
| First published | 2022-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Abdulla Malik |
| Maintainers | saularis |
| Keywords | queue, rabbitmq, consumer, producer |

## Links

- npm: https://www.npmjs.com/package/rabbitmqueue
- Repository: https://github.com/saularis/rabbitmqueue
- Homepage: https://github.com/saularis/rabbitmqueue#readme
- Issues: https://github.com/saularis/rabbitmqueue/issues
- npm.io page: https://npm.io/package/rabbitmqueue

## Dependencies (3)

- [mocha](https://npm.io/package/mocha.md) ^10.2.0
- [sinon](https://npm.io/package/sinon.md) ^15.0.1
- [amqplib](https://npm.io/package/amqplib.md) ^0.10.3

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2023-03-12
- 1.1.0 — 2023-02-11
- 1.0.9 — 2022-11-01
- 1.0.8 — 2022-11-01
- 1.0.7 — 2022-11-01
- 1.0.6 — 2022-11-01

## README

# RabbitMQueue
[![Node.js CI](https://github.com/saularis/rabbitmqueue/actions/workflows/node.js.yml/badge.svg)](https://github.com/saularis/rabbitmqueue/actions/workflows/node.js.yml)

Simple queueing package for task queueing using rabbitmq

## Prerequisite
Install and start rabbitmq. Here's the link to download and installation [guide](https://www.rabbitmq.com/download.html).

## Installation
```properties
npm i rabbitmqueue
```

## Queue Daemon
Create a js file on the root directory of your project. Let's call it `rmq.js`.
```js
const rabbitmqueue = require('rabbitmqueue');

const consumers = {
    'default': function (data) {
        console.dir(data);
    }
};

rabbitmqueue.init("amqp://localhost", consumers);
```
Here `consumers` is an object containing queue names as key and job handling function as value.

We initialize the daemon using `init` where you must pass rabbitmq connection string and consumer object.

### Start Daemon
```properties
node rmq.js
```
>We can use PM2 on production.

## Producer in action
Here's how to push messages to queue.
```js
const rabbitmqueue = require('rabbitmqueue');

const producer = rabbitmqueue.producer("amqp://localhost", ['default']);

producer.produce('default', {
    'key1': 'value1',
    'key2': 'value2'
});
```

---
_Source: https://npm.io/package/rabbitmqueue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
