pub async fn run_concurrent<R, S, E>(handler: S) -> Result<(), Error>Available on crate feature
concurrency-tokio only.Expand description
Starts the Lambda Rust runtime and begins polling for events on the Lambda Runtime APIs.
This takes care of transforming the LambdaEvent into a Request and then
converting the result into a LambdaResponse.
§Managed concurrency
When AWS_LAMBDA_MAX_CONCURRENCY is set to a value greater than 1, this
function spawns multiple tokio worker tasks to handle concurrent invocations.
When the environment variable is unset or <= 1, it falls back to
sequential behavior, so the same handler can run on both classic Lambda
and Lambda Managed Instances.
§Panics
This function panics if:
- Called outside of a Tokio runtime with
AWS_LAMBDA_MAX_CONCURRENCY > 1 - Required Lambda environment variables are missing (
AWS_LAMBDA_FUNCTION_NAME,AWS_LAMBDA_FUNCTION_MEMORY_SIZE,AWS_LAMBDA_FUNCTION_VERSION,AWS_LAMBDA_RUNTIME_API)