In Spring Cloud Stream, I used the functional model and created a Supplier to generateEvents. As per the documentation, I expect that this supplier will get invoked on a scheduled basis, but that's not happening. It gets invoked once upon bean creation, and never again. I'd appreciate any help in figuring out why.
EventSource.java (Supplier):
@Component
@Slf4j
public class EventSource {
@Bean
public Supplier<String> generateEvents() {
log.debug("creating an event to publish to Kafka");
return () -> "Hi I'm an event";
}
}
application.yml:
spring:
cloud:
function:
definition: generateEvents
stream:
bindings:
generateEvents-out-0:
destination: eventsTopic
I know I'm connecting to Kafka, because the topic eventsTopic
gets created upon startup. The Cloud Stream app stays up, but doesn't do anything.