Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 2.37 KB

File metadata and controls

75 lines (57 loc) · 2.37 KB

AWS integration

The SDK separates durable workflow behavior from AWS client/runtime ownership. This keeps the core usable in local runners and lets applications control AWS configuration, credentials, HTTP clients, executors, logging, and shutdown.

AWS SDK for C++ transport

Configure with:

cmake -S . -B build \
  -DDURABLE_EXECUTION_BUILD_AWS_SDK_ADAPTER=ON

Link aws::durable_execution_aws_sdk and construct aws_sdk_service_client from either:

  • a non-owning const Aws::Lambda::LambdaClient&; or
  • an owning std::shared_ptr<const Aws::Lambda::LambdaClient>.

The adapter maps:

  • CheckpointDurableExecutionRequest and its updated execution state;
  • GetDurableExecutionStateRequest pagination;
  • every currently defined operation details/options model;
  • AWS SDK retryability into service_error::retryable;
  • future AWS enum values through the SDK enum-overflow mapper into extensible_enum.

The application must call Aws::InitAPI before constructing the AWS client and Aws::ShutdownAPI after all SDK objects are destroyed.

Lambda C++ runtime

Configure with:

cmake -S . -B build \
  -DDURABLE_EXECUTION_BUILD_LAMBDA_RUNTIME_ADAPTER=ON

Link aws::durable_execution_lambda_runtime. make_lambda_handler returns a callable accepted by aws::lambda_runtime::run_handler.

Malformed durable invocation envelopes are returned as Lambda invocation failures with type DurableExecutionWireError. Valid durable results—including durable statuses FAILED, PENDING, and RETRY—are successful Lambda runtime responses because their status belongs to the durable protocol response body.

Complete entry point

See the Lambda example. In outline:

Aws::SDKOptions options;
Aws::InitAPI(options);
{
  auto client = std::make_shared<Aws::Lambda::LambdaClient>();
  aws::durable_execution::aws_sdk_service_client service{client};
  auto handler = aws::durable_execution::make_lambda_handler(
      service,
      [](std::string_view event) {
        return aws::durable_execution::step([event] {
          return event.empty() ? 0 : 1;
        });
      });
  aws::lambda_runtime::run_handler(handler);
}
Aws::ShutdownAPI(options);

The SDK does not hide the AWS lifecycle in a global singleton. Explicit ownership prevents shutdown-order bugs and lets test code inject a service_client without initializing AWS.