-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda_main.cpp
More file actions
37 lines (31 loc) · 1.08 KB
/
Copy pathlambda_main.cpp
File metadata and controls
37 lines (31 loc) · 1.08 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
#include <memory>
#include <string>
#include <string_view>
#include <aws/core/Aws.h>
#include <aws/lambda/LambdaClient.h>
#include <aws/lambda-runtime/runtime.h>
#include "aws/durable_execution/aws_sdk_service_client.hpp"
#include "aws/durable_execution/lambda_runtime.hpp"
#include "aws/durable_execution/operations.hpp"
namespace durable = aws::durable_execution;
int main() {
Aws::SDKOptions options;
Aws::InitAPI(options);
{
auto lambda_client = std::make_shared<Aws::Lambda::LambdaClient>();
durable::aws_sdk_service_client service{lambda_client};
auto handler = durable::make_lambda_handler(
service, [](std::string_view event) {
return durable::step(
[event] {
// Replace with nondeterministic I/O or business logic.
return event.empty() ? std::string{"empty"}
: std::string{"processed"};
},
durable::step_config{.name = "process_input"});
});
aws::lambda_runtime::run_handler(handler);
}
Aws::ShutdownAPI(options);
return 0;
}