I have implemented a Spring Cloud Function as shown below:
public class CloudFunc implements Function<MyDTO, MyDTO> {
@Override
public MyDTO apply(MyDTO input) {
input.setValue("3");
return input;
}
}
I added below properties in application properties:
spring:
cloud:
function:
definition: cloudFunc
stream:
kafka:
binder:
brokers: localhost:9092
bindings:
cloudFunc-out-0:
destination: produce-topic
cloudFunc-in-0:
destination: consume-topic
group: sample-group
Since I added stream bindings, if any message is added to "consume-topic", then cloudFunc is triggered with that message and output will be sent to product-topic. If I make Rest call to /cloudFunc, that will return the output to the caller of Rest endpoint. How can I bind it in such a way that, the cloud function is triggered via Rest call and output is sent to Kafka output topic with no code changes and only changes in application properties? Is that possible?
TIA