0.0.17 • Published 4 years ago

rabbitmq-decor v0.0.17

Weekly downloads
18
License
MIT
Repository
github
Last release
4 years ago

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
0.0.17

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.14

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.1

4 years ago