QueueAmqp

QueueAmqp

QueueAmqp

Constructor

new QueueAmqp(options)

Parameters:
Name Type Description
options Object

Queue configuration

Properties
Name Type Attributes Default Description
rx String | Boolean

AMQP Read Channel URL

tx String | Boolean

AMQP Write Channel URL

name String <optional>
name

Queue name

type String <optional>
direct

Amqp queue type

exchange String <optional>
{}

Exchange configuration

Source:
See:
Example
const QueueAmqp = require('QueueAmqp');

const queue = new QueueAmqp({ queue: 'tasks', rx: true, tx: true });

queue
.connect()
.then(() => {
  queue.on('task', message => {
    console.log(message);
  });
  queue.emit('task', 'A coffee please !');
});

Extends

Methods

ack(msg) → {QueueAmqp}

Acknowledge the message

Parameters:
Name Type Description
msg Message

Message to acknowledge

Source:
Returns:

The queue used to acknowledge

Type
QueueAmqp

close() → {QueueAmqp}

Close the RX / TX channels.

Source:
Returns:
  • The queue to be closed
Type
QueueAmqp

connect() → {Promise}

Connect the AMQP queue.

Overrides:
Source:
Returns:
  • True when connected
Type
Promise

connectRxTx(type) → {QueueAmqp}

continueect a Rx / Tx queue

Parameters:
Name Type Description
type QUEUE_AMQP_CHANNEL_TYPES

Rx or Tx type for the channel

Source:
Returns:

[description]

Type
QueueAmqp

emit() → {QueueAmqp}

Emit a new message to the queue.

Source:
Returns:
  • The queue to be closed
Type
QueueAmqp

nack(msg) → {QueueAmqp}

Not acknowledge the message

Parameters:
Name Type Description
msg Message

Message to acknowledge

Source:
Returns:

The queue used to acknowledge

Type
QueueAmqp

on() → {QueueAmqp}

Listen to new messages emitted from the queue.

Source:
Returns:
  • The queue to be closed
Type
QueueAmqp

onClose() → {Promise}

On close event emission from AMQP for automatic reconnect.

Source:
Returns:
  • True when reconnected
Type
Promise