Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 6c008f9

Browse files
author
Bruce Felt
authored
v0.3.0 (#11)
1 parent a5f8e4a commit 6c008f9

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v0.3.0 (2019-07-12)
2+
3+
* Allow delaySeconds to be passed in SubmitTaskInput
4+
* Upgrade security dependencies (lodash)
5+
16
## v0.2.0 (2019-07-10)
27

38
* Add TaskClient.submitAllTasks method to send a batch of requests

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ const { taskId } = await client.submitTask({
7272
// taskId: uuid
7373
```
7474

75+
You can optionally also specify `delaySeconds`, which will map to SQS's `DelaySeconds` option (see
76+
[the SQS documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html) for
77+
more info). SQS defaults to the queue's configuration if no value is specified (usually 0 or immediately visible).
78+
79+
```
80+
const { taskId } = await client.submitTask({
81+
operationName: 'SendEmail',
82+
payload: {
83+
recipient: 'foo@bar.com'
84+
},
85+
delaySeconds: 300
86+
})
87+
```
88+
7589
### Submitting Multiple Tasks
7690

7791
To save on network calls (and their resulting potential network failures) you can also use client.submitAllTasks to validate and then submit a batch of tasks to their assigned queues.
@@ -82,7 +96,8 @@ const { results } = await client.submitAllTasks([
8296
operationName: 'SendEmail',
8397
payload: {
8498
recipient: 'foo@bar.com'
85-
}
99+
},
100+
delaySeconds: 300
86101
},
87102
{
88103
operationName: 'SendSMS',
@@ -111,6 +126,9 @@ Notes:
111126
* Each entry in results will be ordered according to the order of the inputs
112127
* The same restrictions for SQS messages apply here, notable that the total payload must not exceed 256 KB
113128

129+
As with submitTask you can optionally specify `delaySeconds` to delay visibility of the SQS message. See [the SQS
130+
documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessageBatch.html) for more information.
131+
114132
### Processing Tasks
115133

116134
Enqueued tasks require a worker to fetch, route, and handle the tasks. This library uses `sqs-consumer` to handle fetching tasks from SQS. The `generateConsumers` method will configure a hashmap of Consumer objects with the configured queueUrl, sqs client, and a handler function using the provided `contextProvider`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fatlama/async-sqs-tasks",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"repository": "github.com/fatlama/async-sqs-tasks-js",

0 commit comments

Comments
 (0)