In the documentation for Spring Cloud Function, the examples for Kotlin consist of function that takes a single parameter, e.g.
@Bean
open fun lower(): (String) -> String = { it.lowercase() }
which is called via a URL that has the single parameter on the end as so:
http://localhost/lower/UpperCaseParam
How can more than one parameter be passed ?
Is something like this supported ?
@Bean
open fun upper(): (String,String) -> String = { x,y -> x+y }
or if not multiple parameters, an object ?
@Bean
open fun upper(): (Pair<String,String>) -> String = { it.first+it.second }
Function by definition has only a single input/output. Even if we were to add support for BiFunction that would only satisfy cases where you have two inputs etc.
The best way to achieve what you want is to use Message Headers which you can pass as HTTP headers.
Then you can make your function signature to accept Function<Message<YourPOJOType>, ...> uppercase();
and then get payload (your main argument, such as request param) and headers from Message.
You can use BiFunction
where second argument would be Map representing message headers and first argument payload. This way you can deal with your types and keep your function completely free from anything Spring. BiFunction<YourPOJOType, Map, ...>