[
https://issues.apache.org/jira/browse/CAMEL-27178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-27178.
---------------------------------
Resolution: Fixed
Fixed by https://github.com/apache/camel/pull/30438
> camel-aws2-lambda - invokeFunction has no option for async invocation (Event)
> -----------------------------------------------------------------------------
>
> Key: CAMEL-27178
> URL: https://issues.apache.org/jira/browse/CAMEL-27178
> Project: Camel
> Issue Type: Improvement
> Components: camel-aws2
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> h3. Problem
> The {{invokeFunction}} operation of {{aws2-lambda}} always invokes the
> function synchronously ({{InvocationType=RequestResponse}}, the SDK default):
> it waits until the function has finished and returns its result. There is no
> endpoint option and no header to set the invocation type, so an asynchronous
> invocation ({{InvocationType=Event}}, Lambda queues the event and answers 202
> at once) or a {{DryRun}} is only possible with {{pojoRequest=true}} and an
> {{InvokeRequest}} body built in Java.
> The Kamelet {{aws-lambda-sink}} cannot offer asynchronous invocation because
> of this: each message waits for the function to end.
> Related: the {{CamelAwsLambdaLogResult}} header is documented as "The last 4
> KB of the execution log", but Lambda returns the log only when the request
> has {{LogType=Tail}}, which cannot be set either, so the header is always
> empty outside of POJO mode.
> h3. Where
> {{components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java}},
> {{invokeFunction(...)}}:
> {code:java}
> request =
> builder.functionName(getEndpoint().getFunction()).payload(determinePayload(exchange)).build();
> {code}
> h3. Suggested change
> * A new endpoint option {{invocationType}} (enum {{RequestResponse}},
> {{Event}}, {{DryRun}}; default {{RequestResponse}}, so nothing changes) and a
> header {{CamelAwsLambdaInvocationType}} that overrides it per message, passed
> to {{InvokeRequest.Builder.invocationType(...)}}.
> * With {{Event}} the response has status code 202 and no payload: keep
> setting {{CamelAwsLambdaStatusCode}}, and document what the body is then.
> * Optionally, in the same way, a {{logType}} option ({{None}}, {{Tail}}) so
> that {{CamelAwsLambdaLogResult}} can be filled.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)