I'm trying to map a Supplier Bean to an Azure function using Spring Cloud Function 2.0, but I need to extend AzureSpringBootRequestHandler, which seems to only support functions with an input parameter and a return value. class AzureSpringBootRequestHandler has two type parameters: input and output, and AzureSpringBootRequestHandler.handleRequest() also expects the input parameter.
@Bean
public Supplier<List<String>> foo() {
return () -> Arrays.asList("foo1", "foo2");
}
/////
class FooFunction extends AzureSpringBootRequestHandler<Void, List<String>> {
@FunctionName("foo")
List<String> foo(@HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST},
authLevel = AuthorizationLevel.FUNCTION) HttpRequestMessage<Optional<String>> request,
ExecutionContext context) {
return handleRequest(null, context);
}
}
The code above causes NPE at reactor.core.publisher.FluxJust.(FluxJust.java:60)
Changing the @Bean return type to Function<Void, List<String>>
causes IllegalStateException "No function defined with name=foo" at AzureSpringFunctionInitializer.lookup
Adding a dummy int parameter works.
P.S Ideally I don't even need the return value so instead of Supplier I would make it a Runnable, but this seems completely unsupported.
Any help would be appreciated.