{cq-description}
Tip
|
Check the Camel Quarkus User guide for prerequisites and other general information. |
In development mode, Quarkus boots up a mock AWS Lambda event server. For further information about how to feed it with mock events, refer to the Quarkus AWS Lambda guide.
$ mvn clean compile quarkus:dev
The above command compiles the project, starts the application and lets the Quarkus tooling watch for changes in your workspace. Any modifications in your project will automatically take effect in the running application.
Tip
|
Please refer to the Development mode section of Camel Quarkus User guide for more details. |
Once you are done with developing you may want to package and run the application.
Tip
|
Find more details about the JVM mode and Native mode in the Package and run section of Camel Quarkus User guide |
Important
|
Native mode requires having GraalVM and other tools installed. Please check the Prerequisites section of Camel Quarkus User guide. |
To prepare a native executable using GraalVM, run the following command:
$ mvn clean package -DskipTests -Pnative
$ ./target/*-runner
Note
|
After you run the build, there are a few extra files generated by the quarkus-amazon-lambda extension. These files are in the build directory: |
-
function.zip - lambda deployment file
-
manage.sh - wrapper around aws lambda cli calls
-
bootstrap-example.sh - example bootstrap script for native deployments
-
sam.jvm.yaml - (optional) for use with sam cli and local testing
-
sam.native.yaml - (optional) for use with sam cli and native local testing
-
Go to AWS Web console and search for Lambda Service
-
Click Create Function and select Author From Scratch
-
Give the name for your function which should be unique
-
Select Java 11 (Corretto) as Runtime
-
Under Permission feel free to create / use existing role to give the required permission for your lambda function
-
Once the function is created click the function name to upload the generated function.zip file and configure it.
-
Scroll down and select the Code tab. Click the upload from dropdown on right-hand side of the screen and select .zip or .jar file
-
Click upload and browse to the path where the generated zip file
target/function.zip
was created and select the function.zip file and click save -
Under the Code tab scroll down to the Runtime settings and click edit
-
For the Handler details please provide the Quarkus Handler
io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest
-
Now select the Test tab for executing a quick test. Copy paste the below json payload and hit Test
{ "name": "Ravishankar" }
-
If everything goes fine you should get the below response along with the lambda execution logs & stats
Hello Ravishankar ! How are you? from GreetService
-
Go to AWS Web console and search for Lambda Service
-
Click Create Function and select Author From Scratch
-
Give the name for your function which should be unique
-
For Runtime please scroll down and Select Provide your own bootstrap on Amazon Linux 2 under Custom Runtime
-
Under Permission feel free to create / use existing role to give the required permission for your lambda function
-
Once the function is created click the function name to upload the generated function.zip file and configure it.
-
Scroll down and select the Code tab. Click the upload from dropdown on right-hand side of the screen and select .zip or .jar file
-
Click upload and browse to the path where the generated zip file
target/function.zip
was created and select the function.zip file and click save -
Under the Code tab scroll down to the Runtime settings and click edit
-
For the Handler details please provide the below Handler
not.used.in.provided.runtime
-
Then Select the Configuration tab and click Environment Variables
-
For Key enter
DISABLE_SIGNAL_HANDLERS
& for Value entertrue
-
Now select the Test tab for executing a quick test. Copy paste the below json payload and hit Test
{ "name": "Ravishankar" }
-
If everything goes fine you should get the below response along with the lambda execution logs & stats
Hello Ravishankar ! How are you? from GreetService