new AmqpConnection()
Once connected to the broker or router, you get a connection. This connection is automatically opened.
Methods
close(done) → {AmqpConnection}
Closes the AMQP connection, i.e. allows the Close frame to be emitted.
Parameters:
| Name | Type | Description |
|---|---|---|
done |
function | the close handler notified when the connection is closed. May be null. |
Returns:
the connection
- Type
- AmqpConnection
createAnonymousSender(completionHandler) → {AmqpConnection}
Creates an anonymous sender.
Unlike "regular" sender, this sender is not associated to a specific address, and each message sent must provide an address. This method can be used in request-reply scenarios where you create a sender to send the reply, but you don't know the address, as the reply address is passed into the message you are going to receive.
Parameters:
| Name | Type | Description |
|---|---|---|
completionHandler |
function | The handler called with the created sender, once opened |
Returns:
the connection.
- Type
- AmqpConnection
createDynamicReceiver(completionHandler) → {AmqpConnection}
Creates a dynamic receiver. The address is provided by the broker and is available in the
completionHandler,
using the AmqpReceiver#address method. this method is useful for request-reply to generate a unique
reply address.
Parameters:
| Name | Type | Description |
|---|---|---|
completionHandler |
function | the completion handler, called when the receiver has been created and opened. |
Returns:
the connection.
- Type
- AmqpConnection
createReceiver(address, receiverOptions, completionHandler) → {AmqpConnection}
Creates a receiver used to consumer messages from the given address.
Parameters:
| Name | Type | Description |
|---|---|---|
address |
string | The source address to attach the consumer to. |
receiverOptions |
Object | The options for this receiver. |
completionHandler |
function | The handler called with the receiver, once opened. Note that the messageHandler can be called before the completionHandler if messages are awaiting delivery. |
Returns:
the connection.
- Type
- AmqpConnection
createSender(address, options, completionHandler) → {AmqpConnection}
Creates a sender used to send messages to the given address. The address must be set. For anonymous sender, check
AmqpConnection#createAnonymousSender.
Parameters:
| Name | Type | Description |
|---|---|---|
address |
string | The target address to attach to, allowed to be null if the options configures the sender to be attached to a dynamic address (provided by the broker). |
options |
Object | The AMQP sender options |
completionHandler |
function | The handler called with the sender, once opened |
Returns:
the connection.
- Type
- AmqpConnection
exceptionHandler(handler) → {AmqpConnection}
Registers a handler called on disconnection.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the exception handler. |
Returns:
- Type
- AmqpConnection