Search code examples
spring-cloud-streamspring-cloud-dataflow

How to implement a rate limiter processor in Spring Cloud Data Flow


I'd like to implement a rate limiter processor that slows down the flow of messages. Here is the diagram. For example, the rate of the incoming message is 100 per second, but the processor should dispatch at 10 per second.

enter image description here

Any suggestion how to implement this?


Solution

  • Take a look at Polled Consumer support in Spring Cloud Stream. This essentially allows your processor to control when to pull the next message from the input channel.

    Or you can implement the processor using reactive programming with back pressure. This may be overkill for your use case.