I am trying to intgerate AWS sqs and AWS lambda. I am using spring cloud function for implementing the lambda. The lambda is configured with a trigger for SQS queue.
Versions used spring-cloud.version 2022.0.3 Java 17 spring-cloud-aws-dependencies 3.0.1
I am using the below handler for invoking my function.
org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest
Below is the bean for reading the message
@Bean
public Function<Message<String>, String> recMsg() {
return v -> {
System.out.println(v.getPayload());
System.out.println(v.getHeaders());
return v.getPayload();
};
}
I see the code is working fine . However the function is called only once for each message. As per my understanding the aws should be able to call the function with a batch of messages.
I see something wrong with my implementation.
Kindly direct me to any documentation which suggests to use a better approach.