Skip to content

Commit f10318d

Browse files
authored
Merge pull request #92 from JasonSia/main
2 parents 5d02e9e + 9aa5dad commit f10318d

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

integration-sqs-to-lambda/Function.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package integration_sqs_to_lambda
2+
3+
import (
4+
"fmt"
5+
"github.com/aws/aws-lambda-go/events"
6+
"github.com/aws/aws-lambda-go/lambda"
7+
)
8+
9+
func handler(event events.SQSEvent) error {
10+
for _, record := range event.Records {
11+
err := processMessage(record)
12+
if err != nil {
13+
return err
14+
}
15+
}
16+
fmt.Println("done")
17+
return nil
18+
}
19+
20+
func processMessage(record events.SQSMessage) error {
21+
fmt.Printf("Processed message %s\n", record.Body)
22+
// TODO: Do interesting work based on the new message
23+
return nil
24+
}
25+
26+
func main() {
27+
lambda.Start(handler)
28+
}

integration-sqs-to-lambda/snippet-data.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Sample Amazon SQS function code",
44
"type": "Integration",
55
"services": ["lambda", "sqs"],
6-
"languages": ["Node", ".NET", "TypeScript", "Java","Python"],
6+
"languages": ["Node", ".NET", "TypeScript", "Java","Python","Go"],
77
"tags": [],
88
"introBox": {
99
"headline": "How it works",
@@ -74,6 +74,17 @@
7474
"language": "py"
7575
}
7676
]
77+
},
78+
{
79+
"id": "Go",
80+
"title": "Usage Example with Golang:",
81+
"description": "Sample Amazon SQS function code using Golang without batch item handling.",
82+
"snippets": [
83+
{
84+
"snippetPath": "Function.go",
85+
"language": "go"
86+
}
87+
]
7788
}
7889
]
7990
}

0 commit comments

Comments
 (0)