0.1.6 • Published 7 years ago

sails-hook-amqp v0.1.6

Weekly downloads
9
License
MIT
Repository
-
Last release
7 years ago

sails-hook-amqp

A wrapper of amqp.node bundled as a sails js Hook that enables you to use the AMQP protocol for sending and receiving messages.

Installation

Configuration

Create a file named amqp.js in your config directory with the following content

The socketOptions property can be omitted if not relevant.

See amqp.node@connect for details.

Usage

Publish

Publish a single message to an exchange.

sails.hooks.amqp.publish(exchange, routingKey, content, options)

The options parameter can be omitted in favour of defaults.

See amqp.node@channel_publish for details.

Examples


Send to Queue

Send a single message with the content given as a buffer, string or JSON to the specific queue named, bypassing routing. The options and return value are exactly the same as for #publish.

sails.hooks.amqp.sendToQueue(queue, content, options)

The options parameter can be omitted in favour of defaults.

See amqp.node@channel_sendToQueue for details.

Examples


Subscribe

sails.hooks.amqp.subscribe(queue || routingKey,onMessageCallback,assertQueueOpts,consumeOpts)

The assertQueueOpts & consumeOpts parameters can be omitted in favour of defaults.

See amqp.node@channel_assertQueue, amqp.node@channel_consume for details.

Example


Other methods


Connecting manually

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago