Let's define Spring Cloud functions like this:
@Bean
public Function<Message, Message> logfileEventFunction() {
log.info("logfileEventFunction consumer defined");
return message -> {
log.info("logfileEventFunction called - {}", message);
return message;
};
}
@Bean
public Consumer<Message> logfileEventConsumer() {
log.info("Logfile consumer defined");
return (logfileEvent) -> {
log.info("Logfile consumer called - {}", logfileEvent);
};
}
with properties like this:
spring.cloud.stream.bindings.logfileEventFunction-out-0.group=logfileEventChannelQueue
spring.cloud.stream.bindings.logfileEventFunction-out-0.destination=logfileEventChannel-out-0
spring.cloud.stream.bindings.logfileEventConsumer-in-0.group=logfileEventChannelQueue
spring.cloud.stream.bindings.logfileEventConsumer-in-0.destination=logfileEventChannel-out-0
Besides defined logfileEventChannelQueue, Spring automatically create anonymous queue called logfileEventFunction-in-0. I'm adding also dependency spring-cloud-function-web to expose functions as an endpoint.
Expected behavior is that Function sends its output via queue to Consumer.
Everything works, when I'm putting message into anonymous queue, which is input for Function. Then Function resend this message to another queue which is bind to Customer.
The problem is that binding Function to output queue doesn't work, when called via REST endpoint. Function is called, but message is not passed to the output queue. Should it? I want to create REST endpoint which blindly outputs everything into queue.