I trying out spring-cloud-funtions, with RabbitMQ integration. So my producer fetches a list of elements with an IO operation (lets say a database call). Instead of the list being posted as one single message, I am trying to make make it post a bunch of separate messages to my exchange. This way my next processor (which consumes from the list) can pick up elements and process them separately. My publisher would look something like this:
@Bean
Supplier<List<Foo>> publisher() {
return str -> fooDAO.findAll();
}
And I would like my queue to be like:
@Bean
Consumer<Foo> consumer() {
return foo -> barDAO.save(foo.getBar());
}
Use the StreamBridge
to send each message.
streamBridge.send("toStream-out-0", someData);