diff --git a/integration-sqs-to-lambda/Function.py b/integration-sqs-to-lambda/Function.py new file mode 100644 index 0000000..fc7d36c --- /dev/null +++ b/integration-sqs-to-lambda/Function.py @@ -0,0 +1,12 @@ +def lambda_handler(event, context): + for message in event['Records']: + process_message(message) + print("done") + +def process_message(message): + try: + print(f"Processed message {message['body']}") + # TODO: Do interesting work based on the new message + except Exception as err: + print("An error occurred") + raise err diff --git a/integration-sqs-to-lambda/snippet-data.json b/integration-sqs-to-lambda/snippet-data.json index c907ab5..56f897f 100644 --- a/integration-sqs-to-lambda/snippet-data.json +++ b/integration-sqs-to-lambda/snippet-data.json @@ -3,7 +3,7 @@ "description": "Sample Amazon SQS function code", "type": "Integration", "services": ["lambda", "sqs"], - "languages": ["Node", ".NET", "TypeScript", "Java"], + "languages": ["Node", ".NET", "TypeScript", "Java","Python"], "tags": [], "introBox": { "headline": "How it works", @@ -63,6 +63,17 @@ "language": "java" } ] + }, + { + "id": "Python", + "title": "Usage Example with Python:", + "description": "Sample Amazon SQS function code using Python without batch item handling.", + "snippets": [ + { + "snippetPath": "Function.py", + "language": "py" + } + ] } ] } @@ -89,6 +100,12 @@ "name": "Girish B", "bio": "Senior Solutions Architect at AWS", "linkedin": "girishbalachandran" + }, + { + "headline": "Python Example Presented by Girish B", + "name": "Sanskar", + "bio": "Cloud Support Engineer at AWS", + "linkedin": "Sanskar05" } ] }