GH-786 Fix regression with RoutingFunction over AWS APIGateway
Resolves #786
This commit is contained in:
@@ -10,18 +10,17 @@ You can do so in two different ways.
|
||||
1. You can provide `spring_cloud_function_definition` environment variable setting its value to the desired function definition, which could also be composition
|
||||
(e.g., `spring_cloud_function_definition=foo|bar`).
|
||||
|
||||
2. A more dynamic and recommended approach would be to fallback on auto routing capabilities of spring-cloud function's in AWS environment.
|
||||
Basically every time you have more then one function in your configuration, the framework will bind
|
||||
[Routing Function](https://docs.spring.io/spring-cloud-function/docs/3.1.3/reference/html/spring-cloud-function.html#_function_routing_and_filtering)
|
||||
as AWS Lambda, and all you need to to is provide a routing instruction via Message headers or environment variables. The instructions could themselves be very dynamic,
|
||||
since we support both SpEL and registering a callback interface. For more details on routing mechanisms please refer to
|
||||
[Function Routing and Filtering](https://docs.spring.io/spring-cloud-function/docs/3.1.3/reference/html/spring-cloud-function.html#_function_routing_and_filtering) section.
|
||||
|
||||
|
||||
NOTE: Keep in mind though that since AWS does not allow dots `.` and/or hyphens`-` in the name of the environment variable, you can benefit from boot support and simply substitute
|
||||
dots with underscores and hyphens with camel case. So for example `spring.cloud.function.definition` becomes `spring_cloud_function_definition`
|
||||
and `spring.cloud.function.routing-expression` becomes `spring_cloud_function_routingExpression`.
|
||||
|
||||
2. A more dynamic and recommended approach would be to fallback on auto routing capabilities of spring-cloud function's in AWS environment.
|
||||
Basically every time you have more then one function in your configuration, the framework will bind
|
||||
[Routing Function](https://docs.spring.io/spring-cloud-function/docs/3.1.3/reference/html/spring-cloud-function.html#_function_routing_and_filtering)
|
||||
as AWS Lambda, and all you need to to is provide a routing instruction via Message headers or environment variables. The instructions could themselves be very dynamic, since we support both SpEL and registering a callback interface. For more details on routing mechanisms please refer to
|
||||
[Function Routing and Filtering](https://docs.spring.io/spring-cloud-function/docs/3.1.3/reference/html/spring-cloud-function.html#_function_routing_and_filtering) section.
|
||||
|
||||
|
||||
In this example we have configuration with two functions; `uppercase` and `reverse`.
|
||||
When executing from AWS Lambda functions dashboard you can simply provide one of the mentioned properties as environment variables via Configuration tab.
|
||||
For example, you can set `spring_cloud_function_routingExpression` environment variable with the value of literal; SpEL expression `'uppercase'` (not the single quotes).
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-aws</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
|
||||
Reference in New Issue
Block a user