Solace Community is getting a facelift!
On March 3rd we will be starting the process of migrating Solace Community to a new platform. As a result, Solace Community will go in to a temporary read-only state. You will still be able to come onto Solace Community and search through posts to find answers, but you won't be able to ask questions, post comments, or react in any way.
We hope to have the migration complete by Wednesday March 5th (or sooner), so please keep an eye out!
@PollableBean for Reactive Suppliers in Spring Cloud Stream

Supplier
beans, or functions that only publish messages in Spring Cloud Stream, are a bit special in that they aren't triggered by the receiving of events like Function
or Consumer
beans. This means that you often need a way to trigger them to be executed periodically.
For imperative functions the framework by default "polls" a Supplier
function every 1 second, but that duration is configurable using the spring.cloud.stream.poller.fixed-delay
property.
However, for reactive functions supplying a Flux
it is only triggered once by default. This is because a Flux itself is potentially an infinite stream of events so in many cases it will only need to be triggered once. But don't worry, if you want to periodically trigger a reactive Supplier
because you are producing a finite stream of events you can still do so using @PollableBean
. This annotation then allows you to configure how often the function is triggered using the same spring.cloud.stream.poller.fixed-delay
property!
One example use case here could be periodically querying a data store and publishing each entry/row as an event. The number of rows in your data store is a finite number at any given time.
Example code:
@PollableBean public Supplier<Flux<String>> stringSupplier() { return () -> Flux.just("foo","bar","baz"); }