1

I'm trying to implement suppliers using Spring Cloud Function and Kafka. I need that one supplier should publish after every 10 secs and other should publish after every 30 secs. I could see from documentation, I can change delay using spring.cloud.stream.poller.fixed-delay property. Reference

But I need to set different delay for each topic. Is there any way to do it?

VaibS
  • 1,627
  • 1
  • 15
  • 21

2 Answers2

0

From the spring-cloud-function perspective there isn't any kind of polling as it is not the responsibility of the framework. From the spring-cloud-stream perspective that uses spring-cloud-function indeed there is a mechanism that you have described. However, keep in mind that spring-cloud-stream is primarily designed to support concept of microservices (not your general messaging framework) and in microservices we embrace do one thing but do it well without affecting others approach. So having more then one supplier kind of goes against this model. If you are building a general purpose messaging app, then i'd suggest to use Spring Integration framework which provides all the necessary hooks to accomplish what you need, but will require a bit more configuration details.

Oleg Zhurakousky
  • 5,820
  • 16
  • 17
0

Thanks to courtesy of Oleg this feature is now implemented, here is PR. Now we can define poller per producer like this:

spring.cloud.stream.bindings.supply-out-0.producer.poller.fixed-delay=3000

See also: Configure Poller for the specific supplier in Spring Cloud Stream

nouveu
  • 162
  • 4
  • 9