-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathtemplate.yaml
More file actions
65 lines (60 loc) · 1.91 KB
/
Copy pathtemplate.yaml
File metadata and controls
65 lines (60 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: SAM Template for Spring Cloud Function Demo
Globals:
Function:
Timeout: 20
MemorySize: 1024
Runtime: java21
Resources:
# SQS Queue
MessageQueue:
Type: AWS::SQS::Queue
Properties:
VisibilityTimeout: 30
MessageRetentionPeriod: 345600 # 4 days
# API Function
SpringCloudFunction:
Type: AWS::Serverless::Function
Properties:
Handler: org.springframework.cloud.function.adapter.aws.FunctionInvoker
CodeUri: .
Environment:
Variables:
MAIN_CLASS: com.amazonaws.springcloudfunctiondemo.SpringCloudFunctionDemoApplication
SPRING_CLOUD_FUNCTION_DEFINITION: upperCase
Events:
ApiEvent:
Type: Api
Properties:
Path: /uppercase
Method: post
# SQS Consumer Function
MessageProcessor:
Type: AWS::Serverless::Function
Properties:
Handler: org.springframework.cloud.function.adapter.aws.FunctionInvoker
CodeUri: .
Environment:
Variables:
MAIN_CLASS: com.amazonaws.springcloudfunctiondemo.SpringCloudFunctionDemoApplication
SPRING_CLOUD_FUNCTION_DEFINITION: asyncProcessor
Events:
SQSEvent:
Type: SQS
Properties:
Queue: !GetAtt MessageQueue.Arn
BatchSize: 10
Outputs:
SpringCloudFunctionApi:
Description: API Gateway endpoint URL for Prod stage for Spring Cloud Function
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/uppercase/"
SpringCloudFunction:
Description: Spring Cloud Function Lambda Function ARN
Value: !GetAtt SpringCloudFunction.Arn
MessageProcessorFunction:
Description: Message Processor Lambda Function ARN
Value: !GetAtt MessageProcessor.Arn
QueueURL:
Description: URL of the SQS Queue
Value: !Ref MessageQueue