I have simple @Bean
(Java 8 Functions) which are mapped to a destination topic
(-out
and -in
).
@Bean
public Function<String, String> transform() {
return payload -> payload.toUpperCase();
}
@Bean
public Consumer<String> receive() {
return payload -> logger.info("Data received: " + payload);
}
.yml config:
spring:
cloud:
stream:
function:
definition: transform;receive
bindings:
transform-out-0:
destination: myTopic
receive-in-0:
destination: myTopic
Now, I want to invoke the transform
function via a REST
call so that it's output goes to the destination topic
(i.e. transform-out-0
mapped to myTopic
) and is picked up by the consumer
from this destination (receive-in-0
mapped to myTopic
). Basically, every REST call should spawn a new instance of a KAFKA Producer
and close it.
How can I achieve this please using spring-cloud-stream
?
Thanks
Angshuman