I need to call my lambda - A from lambda - B. I have done the required code but need few clarifications.
AWSLambda lambdaClient = AWSLambdaClientBuilder.standard().withRegion(region)
.withCredentials(new DefaultAWSCredentialsProviderChain()).build();
InvokeRequest request = new InvokeRequest().withClientContext(clientContext).withFunctionName(functionName)
.withQualifier(alias).withPayload(payload).withInvocationType(InvocationType.Event);
InvokeResult response = lambdaClient.invoke(request);
I have a N number of table names which I need to pass from lambda B to lambda A one by one so that it can do the needful work on that DDB table.
The problem is withPayload
takes a JSON payload which is passed to the lambda function.
I will pass the payload to lambda-B but then the code is calling lambdaClient.invoke(request)
which will have all the table names and it will call our lambda-A. But handler function in the lambda-A expects a single table name.
I am not sure how to do this.
Also do i need to run this in a loop so that every time it takes new payload value and then calls lambdaClient.invoke(request)
or does it happen automatically?