This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit cb98d8411bbcec0990c0a6ee7cd2d36efd901ea9
Author: Andrea Cosentino <[email protected]>
AuthorDate: Wed Sep 15 11:23:25 2021 +0200

    CAMEL-16849 - Add at least one example for component in docs - 
Camel-AWS2-Lambda
---
 .../src/main/docs/aws2-lambda-component.adoc       | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git 
a/components/camel-aws/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc
 
b/components/camel-aws/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc
index 924b6a7..090a47d 100644
--- 
a/components/camel-aws/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc
+++ 
b/components/camel-aws/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc
@@ -264,6 +264,39 @@ The default is 3 seconds.|No
 
 To have a full understanding of how the component works, you may have a look 
at these 
https://github.com/apache/camel/tree/main/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/integration[integration
 tests]
 
+=== Producer Examples
+
+- CreateFunction: this operation will create a function for you in AWS Lambda
+
+[source,java]
+--------------------------------------------------------------------------------
+  
from("direct:createFunction").to("aws2-lambda://GetHelloWithName?operation=createFunction").to("mock:result");
+--------------------------------------------------------------------------------
+
+and by sending
+
+[source,java]
+--------------------------------------------------------------------------------
+        template.send("direct:createFunction", ExchangePattern.InOut, new 
Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(Lambda2Constants.RUNTIME, 
"nodejs6.10");
+                exchange.getIn().setHeader(Lambda2Constants.HANDLER, 
"GetHelloWithName.handler");
+                exchange.getIn().setHeader(Lambda2Constants.DESCRIPTION, 
"Hello with node.js on Lambda");
+                exchange.getIn().setHeader(Lambda2Constants.ROLE,
+                        
"arn:aws:iam::643534317684:role/lambda-execution-role");
+
+                ClassLoader classLoader = getClass().getClassLoader();
+                File file = new File(
+                        classLoader
+                                
.getResource("org/apache/camel/component/aws2/lambda/function/node/GetHelloWithName.zip")
+                                .getFile());
+                FileInputStream inputStream = new FileInputStream(file);
+                exchange.getIn().setBody(inputStream);
+            }
+        });
+--------------------------------------------------------------------------------
+
 == Using a POJO as body
 
 Sometimes build an AWS Request can be complex, because of multiple options. We 
introduce the possibility to use a POJO as body.

Reply via email to