Skip to content

Commit 6e40681

Browse files
committed
Clarify asyncInvocation
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 6684ba1 commit 6e40681

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/openfaas-pro/sqs-events.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ On the blog: [How to integrate OpenFaaS functions with managed AWS services](htt
3737

3838
`maxMessages` - Maximum messages to fetch at once - between 1-10
3939

40+
`asyncInvocation` - when set to true, every message will be dequeued and transferred to the built-in queueing system in OpenFaaS. The queue system in OpenFaaS is ideal for long-running functions, or functions that need to be retried if a non-200 status code is returned. This means the SQS connector can move onto the next message without holding up the processing of pending messages.
41+
4042
Each time a function is invoked by the connector it will receive the message from the queue as the HTTP body.
4143

4244
It'll also receive two HTTP headers:
@@ -65,24 +67,24 @@ faas-cli new --lang golang-middleware resize-image
6567

6668
Now add an annotation for the `s3-put-image` queue, so that the `resize-image` function is invoked for any message received:
6769

68-
```yaml
70+
```diff
6971
version: 1.0
7072
provider:
7173
name: openfaas
7274
gateway: http://127.0.0.1:8080
7375

7476
functions:
7577
resize-image:
76-
annotations:
77-
topic: s3-put-image
7878
lang: golang-middleware
7979
handler: ./resize-image
8080
image: ghcr.io/openfaas/resize-image:latest
81+
+ annotations:
82+
+ topic: s3-put-image
8183
```
8284

83-
Edit the HTTP handler at `./s3-put-image/handler.go` so it prints out the HTTP body and headers to its logs.
85+
Edit the HTTP handler at `./s3-put-image/handler.go` and do something with the message you received.
8486

85-
You can find a complete example here: [printer function written in Go](https://github.com/openfaas/store-functions/tree/master/printer).
87+
The [Printer function written in Go](https://github.com/openfaas/store-functions/tree/master/printer) is part of the OpenFaaS function store, and can be used as a reference for printing out the incoming HTTP request.
8688

8789
Test it out:
8890

0 commit comments

Comments
 (0)