Connecting the Lambda functions
So far, we have set up the mock AWS components for S3 and SQS, and we created two Lambda functions, one for REST-based communication and one for SQS-based communication. In an AWS environment, both functions would be seamlessly integrated, since by publishing a message to SQS, AWS handles the dispatching of that message to the Lambda function that should process it.
This seamless integration is what we miss in the current state of our Compose application. In order to facilitate this functionality, we shall create a service that pulls images from SQS and pushes them to the SQS-based function.
The code base is very streamlined:
session, _ := sqsSession() queueUrl := aws.String(os.Getenv(SQS_TOPIC_ENV)) msgResult, _ := session.ReceiveMessage(&sqs.ReceiveMessageInput{ QueueUrl: queueUrl, }) if msgResult != nil && len(msgResult.Messages) > 0 { sqsEvent := map[string][]*sqs.Message{ ...