# rabbitmq-decor

> rabbitmq-decor is a RabbitMQ library presented as a set of class and method decorators for node services.

Latest version **0.0.17** (published 2020-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install rabbitmq-decor
pnpm add rabbitmq-decor
yarn add rabbitmq-decor
bun add rabbitmq-decor
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.17 |
| Published | 2020-09-25 |
| First published | 2020-09-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 229 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Bren Norris |
| Maintainers | verikono |

## Links

- npm: https://www.npmjs.com/package/rabbitmq-decor
- Repository: https://github.com/verikono/rabbitmq-decor
- Homepage: https://github.com/verikono/rabbitmq-decor#readme
- Issues: https://github.com/verikono/rabbitmq-decor/issues
- npm.io page: https://npm.io/package/rabbitmq-decor

## Dependencies (6)

- [uuid](https://npm.io/package/uuid.md) ^8.3.0
- [amqplib](https://npm.io/package/amqplib.md) ^0.6.0
- [typescript](https://npm.io/package/typescript.md) ^4.0.2
- [@types/uuid](https://npm.io/package/@types/uuid.md) ^8.3.0
- [@types/amqplib](https://npm.io/package/@types/amqplib.md) ^0.5.13
- [simple-node-logger](https://npm.io/package/simple-node-logger.md) ^18.12.24

## Recent versions

- 0.0.17 (latest) — 2020-09-25
- 0.0.16 — 2020-09-15
- 0.0.15 — 2020-09-15
- 0.0.14 — 2020-09-15
- 0.0.13 — 2020-09-15
- 0.0.12 — 2020-09-15
- 0.0.11 — 2020-09-14
- 0.0.10 — 2020-09-14
- 0.0.9 — 2020-09-11
- 0.0.8 — 2020-09-11
- 0.0.7 — 2020-09-11
- 0.0.6 — 2020-09-11
- 0.0.5 — 2020-09-11
- 0.0.4 — 2020-09-11
- 0.0.3 — 2020-09-11
- … 1 more at https://npm.io/package/rabbitmq-decor/versions

## README

rabbitmq-decor is a RabbitMQ library presented as a set of class and method decorators for node services.

A number of message patterns are supported including:

 - FnF (fire and forget), your method will simply respond to any message that appears on the argued queue.
 - RPC (remote procedural call), your method will respond to any message on the queue, returning the method return to the replyTo queue.

Development

Add a file called .env at the project root so dotenv can provide environment variables to the testsuite.


rabbit_service:

    decorate a class, allowing methods to join the message queue

    args:
        options: Object - an options object
        options.URI: String - the URI of the rabbitmq service (eg. "amqp://user:pass@server:port"). default is the environment variable "RABBIT_URI"
        options.PERSISTENT_CONNECTION: Boolean - use a single shared connection for all queue endpoints (default true)

    example of use
    `
        @rabbit_service({URI: 'amqp://user:pass@place'})
        class MyClass {

        }
    `

rpc:

    rpc.listen:
        decorates a rabbit_service class method to the AMQP queue.

        args:
            queue: String - the name of the queue
            options: Object - see #queue options

        example of use:
        `
            @rabbit_service({URI: 'amqp://user:pass@place'})
            class MyClass {

                @rpc.listen(`hello_world`)
                async helloWord( msg ) {
                    return 'hello there';
                }

            }
        `

    rpc.serve:
        @todo

    rpc.invoke:
        @todo

    rpc.close:

fnf:

    fnf.listen:
        decorates a rabbit_service class method to the AMQP queue

    rpc.serve:
        @todo

    rpc.invoke:
        @todo

    rpc.close:
        @todo


Environment Variables:

    RABBIT_URI: the server location - example: amqp://user:pass@server:port
    LOGFILE: the absolute file location for a logfile (default:none, logging will occur on std out)
    TIMEFORMAT: A timeformat for log output : example YYYY-MM-DD HH:mm:ss.SSS

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