diff --git a/docs/getting-started/quickstart.md b/docs/getting-started/quickstart.md index 42111e0..f5149ea 100644 --- a/docs/getting-started/quickstart.md +++ b/docs/getting-started/quickstart.md @@ -1,7 +1,7 @@ # Quickstart Create and deploy your first durable function using the AWS CLI. This guide covers -TypeScript and Python. +TypeScript, Python, and Java. !!! note "Adding all your dependencies to the deployment package" @@ -24,6 +24,10 @@ TypeScript and Python. - Python 3.13+ +=== "Java" + + - Java 17+ and Maven 3.8+ + ## Create the execution role Create an IAM role that grants your function permission to perform checkpoint @@ -65,11 +69,6 @@ Note the role ARN returned. You'll need it in the next step. ## Write the durable function -!!! note "Using Java?" - - Java durable functions currently only deploy in container images. See - [Quickstart for Container Image](quickstart-container-image.md). - === "TypeScript" Save as `index.mjs` @@ -86,6 +85,14 @@ Note the role ARN returned. You'll need it in the next step. --8<-- "examples/python/getting-started/quickstart.py" ``` +=== "Java" + + Save as `QuickstartFunction.java` + + ```java + --8<-- "examples/java/getting-started/quickstart.java" + ``` + The wait here is for 10 seconds just for an easy quick example, but it could as easily be 10 days without incurring extra compute. @@ -133,6 +140,56 @@ execution role you just created. --durable-config '{"ExecutionTimeout": 900, "RetentionPeriodInDays": 1}' ``` +=== "Java" + + Set up a Maven project with the following `pom.xml` dependencies: + + ```xml + + software.amazon.lambda.durable + aws-durable-execution-sdk-java + 1.1.0 + + + com.amazonaws + aws-lambda-java-core + 1.4.0 + + ``` + + Add the `maven-shade-plugin` to produce a fat jar with all dependencies bundled: + + ```xml + + org.apache.maven.plugins + maven-shade-plugin + 3.6.2 + + false + + + + package + shade + + + + ``` + + Build the fat jar and deploy: + + ```console + mvn clean package -DskipTests + + aws lambda create-function \ + --function-name my-durable-function \ + --runtime java21 \ + --role arn:aws:iam::123456789012:role/durable-function-role \ + --handler QuickstartFunction::handleRequest \ + --zip-file fileb://target/*.jar \ + --durable-config '{"ExecutionTimeout": 900, "RetentionPeriodInDays": 1}' + ``` + ### Publish a version You must invoke a durable functions with a published version or alias to ensure