Constructor
new RabbitMQ(optsopt)
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object |
<optional> |
RabbitMQ connection options.
Properties
|
- Source:
Methods
connect() → {Promise}
Connect to the RabbitMQ server.
- Source:
Returns:
Promise that resolves once connection is established.
- Type
- Promise
disconnect() → {Promise}
Disconnect from RabbitMQ.
- Source:
Returns:
Promise resolved when disconnected from RabbitMQ.
- Type
- Promise
publishEvent(queue, content) → {Promise}
Sends an object representing a message to an exchange for the specified
event.
Parameters:
Name | Type | Description |
---|---|---|
queue |
String | Exchange to receive the message. |
content |
Object | Content to send. |
- Source:
Returns:
Promise resolved when message is sent to the exchange.
- Type
- Promise
publishTask(queue, content) → {Promise}
Takes an object representing a message and sends it to a task queue.
Parameters:
Name | Type | Description |
---|---|---|
queue |
String | Task queue to receive the message. |
content |
Object | Job to send. |
- Source:
Returns:
Promise resolved when message is sent to queue.
- Type
- Promise
publishToExchange(queue, routingKey, content) → {Promise}
Takes an object representing a message and sends it to an exchange using
a provided routing key.
Note: Providing an empty string as the routing key is functionally the same
as sending the message directly to a named queue. The function
RabbitMQ#publishToQueue is preferred in this case.
Parameters:
Name | Type | Description |
---|---|---|
queue |
String | Exchange to receive the message. |
routingKey |
String | Routing Key for the exchange. |
content |
Object | Content to send. |
- Deprecated:
- Yes
- Source:
Returns:
Promise resolved when message is sent to the exchange.
- Type
- Promise
publishToQueue(queue, content) → {Promise}
Takes an object representing a message and sends it to a queue.
Parameters:
Name | Type | Description |
---|---|---|
queue |
String | Queue to receive the message. |
content |
Object | Content to send. |
- Deprecated:
- Yes
- Source:
Returns:
Promise resolved when message is sent to queue.
- Type
- Promise