new AmqpSender()
AMQP Sender interface used to send messages.
Methods
address() → {string}
Returns:
the configured address.
- Type
- string
close(handler)
Closes the sender.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | called when the sender has been closed, must not be null |
connection() → {AmqpConnection}
Gets the connection having created the sender. Cannot be
null
Returns:
the connection having created the sender.
- Type
- AmqpConnection
drainHandler(handler) → {WriteStream}
Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write
queue is ready to accept buffers again. See for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been
reduced to
maxSize / 2.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the handler |
Returns:
a reference to this, so the API can be used fluently
- Type
- WriteStream
end(data, handler)
Same as but with an
handler called when the operation completes
Parameters:
| Name | Type | Description |
|---|---|---|
data |
AmqpMessage | |
handler |
function |
exceptionHandler(handler) → {AmqpSender}
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
Returns:
- Type
- AmqpSender
send(message) → {AmqpSender}
Sends an AMQP message. The destination the configured sender address or the address configured in the message.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
AmqpMessage | the message, must not be null |
Returns:
the current sender
- Type
- AmqpSender
sendWithAck(message, acknowledgementHandler) → {AmqpSender}
Sends an AMQP message and waits for an acknowledgement. The acknowledgement handler is called with an
marked as failed if the message has been rejected or re-routed. If the message has been accepted,
the handler is called with a success.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
AmqpMessage | the message, must not be null |
acknowledgementHandler |
function | the acknowledgement handler, must not be null |
Returns:
the current sender
- Type
- AmqpSender
setWriteQueueMaxSize(maxSize) → {AmqpSender}
Parameters:
| Name | Type | Description |
|---|---|---|
maxSize |
number |
Returns:
- Type
- AmqpSender
write(data, handler)
Same as but with an
handler called when the operation completes
Parameters:
| Name | Type | Description |
|---|---|---|
data |
AmqpMessage | |
handler |
function |
writeQueueFull() → {boolean}
This will return
true if there are more bytes in the write queue than the value set using AmqpSender#setWriteQueueMaxSize
Returns:
true if write queue is full
- Type
- boolean