Hybrid MicroProfile Deployments with Quarkus: Severless with AWS Lambda and Standalone Thin JARs

Stateless MicroProfile (and slightly refactored Jakarta EE) applications can be deployed with Quarkus as AWS Lambdas using the quarkus-amazon-lambda-rest and quarkus-amazon-lambda-http extensions.

Both extensions are changing the build output from an executable JAR to target/function.zip containining the Quarkus-specific AWS Lambda handler (io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest) with all dependencies. The function.zip archive is not executable as a standalone application.

For hybrid deployments (standalone and serverless), the AWS Lambda specific extensions can be extracted into a profile:


<profiles>
    <profile>

    <id>lambda</id>
    <activation>
      <property>
        <name>lambda</name>
      </property>
    </activation>
    <dependencies>
      <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-amazon-lambda-http</artifactId>
      </dependency>
    </dependencies>

   </profile>
  <profile>
    <id>native</id>
    <activation>
      <property>
        <name>native</name>
<!-- ... -->
</profiles>

...and activated with: mvn package -Plambda

The ordinary mvn package build creates the executable: target/quarkus-app/quarkus-run.jar, with the activated profile mvn package -Plambda the AWS Lambda specific archive: target/function.zip is created.

The target/function.zip archive deployable with CDK for Java, checkout e.g. github.com/AdamBien/aws-quarkus-lambda-cdk-plain

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments
License