Constructor
# new SQSService(sqsClient)
Creates an instance of SQSService.
Parameters:
| Name | Type | Description |
|---|---|---|
sqsClient |
AWS.SQS
|
An instance of AWS.SQS |
Methods
# async countMessages(queueUrl) → {Promise.<number>}
Count the approximate number of messages in the specified SQS queue.
Parameters:
| Name | Type | Description |
|---|---|---|
queueUrl |
string
|
The URL of the SQS queue. |
- The approximate number of messages.
Promise.<number>
# async deleteMessage(queueUrl, receiptHandle) → {Promise.<Object>}
Delete a message from the specified SQS queue.
Parameters:
| Name | Type | Description |
|---|---|---|
queueUrl |
string
|
The URL of the SQS queue. |
receiptHandle |
string
|
The receipt handle of the message to delete. |
- The result from SQS.
Promise.<Object>
# async purgeQueue(queueUrl) → {Promise.<Object>}
Purge all messages from the specified SQS queue.
Parameters:
| Name | Type | Description |
|---|---|---|
queueUrl |
string
|
The URL of the SQS queue. |
- The result from SQS.
Promise.<Object>
# async receiveMessages(queueUrl, maxNumberOfMessagesopt) → {Promise.<Array>}
Receive messages from the specified SQS queue.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
queueUrl |
string
|
The URL of the SQS queue. |
||
maxNumberOfMessages |
number
|
<optional> |
1 | Max number of messages to retrieve. |
- Array of messages received.
Promise.<Array>
# async sendMessage(queueUrl, messageBody) → {Promise.<Object>}
Send a message to the specified SQS queue.
Parameters:
| Name | Type | Description |
|---|---|---|
queueUrl |
string
|
The URL of the SQS queue. |
messageBody |
Object
|
The message body to send. |
- The result from SQS.
Promise.<Object>