Created
May 5, 2023 01:58
-
-
Save yogyrahmawan/6ac47002d26db1fb9b9f5b79998780e1 to your computer and use it in GitHub Desktop.
sst sqs subscription
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Stack, App } from '@serverless-stack/resources'; | |
import { Function } from '@serverless-stack/resources/aws'; | |
import { SqsSubscription } from '@serverless-stack/resources/aws/sqs'; | |
export default function main(app: App) { | |
const stack = new Stack(app, 'my-stack'); | |
// Create an SQS queue | |
const myQueue = stack.addQueue('MyQueue'); | |
// Create a Lambda function | |
const myFunction = new Function(stack, 'MyFunction', { | |
handler: 'src/myFunction.handler', | |
}); | |
// Subscribe the Lambda function to the SQS queue | |
new SqsSubscription(stack, 'MySubscription', { | |
queue: myQueue, | |
handler: myFunction, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment