0

I want to use Spring cloud function with API Gateway and lambda.

I have been reading about lambda and spring cloud functions, is there anyway to get hold of query parameters in the lambda that are passed in via api gateway..im trying to follow the documentation

@SpringBootApplication
public class Application {
  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
  }

  @Bean
  public Function<String, String> uppercase() {
    // get access to query params
    return value -> value.toUpperCase();
  }
}

previously there was a springbootapigatewayrequest handler that would give you access to the query parameters. But thats been replaced?

Can someone help ?

user1555190
  • 2,803
  • 8
  • 47
  • 80

1 Answers1

1

Yes, you can change function signature to public Function<Message<String>, String> uppercase() and get everything from message headers (we copy everything there). You can also change signature to Function<APIGatewayProxyRequestEvent, ...>

Oleg Zhurakousky
  • 5,820
  • 16
  • 17
  • Thank you... i just found the APIGatewayProxyRequestEvent while searching it should do what i need. Out of curiosity, what are the takeaways related to performance, even though its not a major concern in my scenario, im curious to know or if you cold point me to data.. – user1555190 Nov 01 '21 at 16:37
  • So i have that deployed in AWS, however it keeps timing out. I tested with a function invoker example and it works fine. Im using the "springbootStreamHandler" with APIGatewayProxyRequestEvent ? – user1555190 Nov 02 '21 at 12:02
  • dont need to use the springbootstreamhandler, can use the functioninvoker. Interesting some examples i found use the streamhandler. – user1555190 Nov 02 '21 at 13:30