[{"data":1,"prerenderedAt":65},["ShallowReactive",2],{"pattern-lambda-sqs-java-sam":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":12,"deploy":15,"description":18,"extension":19,"framework":20,"gitHub":21,"highlight":6,"introBox":27,"language":31,"level":32,"meta":33,"patternArch":34,"resources":48,"s3URL":6,"services":6,"stem":57,"testing":58,"videoId":6,"__hash__":64},"patterns\u002Fpatterns\u002Flambda-sqs-java-sam.json","AWS Lambda to Amazon SQS",null,{"headline":8,"text":9},"Cleanup",[10,11],"1. Delete the stack: \u003Ccode>sam delete --stack-name STACK_NAME\u003C\u002Fcode>.","2. Confirm the stack has been deleted: \u003Ccode>aws cloudformation list-stacks --query \"StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus\"\u003C\u002Fcode>",[13,14],"content\u002Fcontributors\u002Fsteven-cook.json","content\u002Fcontributors\u002Fjames-beswick.json",{"text":16},[17],"sam deploy --guided","Create a Lambda function that publishes to an SQS queue","json","AWS SAM",{"template":22},{"projectFolder":23,"repoURL":24,"templateURL":25,"templateFile":26},"lambda-sqs-java","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Flambda-sqs-java","serverless-patterns\u002Flambda-sqs-java","template.yaml",{"headline":28,"text":29},"How it works",[30],"The SAM template deploys a Lambda function, an SQS queue and the IAM permissions required to run the application. The Lambda function publishes a message to the SQS queue when invoked.","Java","100",{},{"icon1":35,"icon2":40,"line1":44},{"x":36,"y":37,"service":38,"label":39},20,50,"lambda","AWS Lambda",{"x":41,"y":37,"service":42,"label":43},80,"sqs","SQS",{"from":45,"to":46,"label":47},"icon1","icon2","",{"headline":49,"bullets":50},"Additional resources",[51,54],{"text":52,"link":53},"Choosing between messaging services for serverless applications.","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fchoosing-between-messaging-services-for-serverless-applications\u002F",{"text":55,"link":56},"Using AWS Lambda with Amazon SQS","https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fwith-sqs.html","patterns\u002Flambda-sqs-java-sam",{"headline":59,"text":60},"Testing",[61,62,63],"Use the AWS CLI to invoke the Lambda function. The function name is in the outputs of the AWS SAM deployment (the key is QueuePublisherFunction):","1. Invoke the Lambda function to publish a message to the SQS queue: \u003Ccode>aws lambda invoke --function-name ENTER_YOUR_FUNCTION_NAME outfile.txt\u003C\u002Fcode>.","2. Retrieve the message from the SQS queue, using the queue URL from the AWS SAM deployment outputs: \u003Ccode>aws sqs receive-message --queue-url ENTER_YOUR_QUEUE_URL\u003C\u002Fcode>","hUyQuwd3HmrZy5PDCIK2AzyvzHB620dkNWpvS__Zd64",1778927709966]