Spring Cloud Stream: Polling configuration for consumer

23 Views Asked by At

The doc here: https://docs.spring.io/spring-cloud-stream/docs/current/reference/html/spring-cloud-stream.html#_polling_configuration_properties shows that we can control the rate of messages being sent out by a supplier by using spring.cloud.stream.bindings.supply-out-0.producer.poller.fixed-delay. I wonder if it is possible to use this feature on consumer. I want consumer to poll message from a queue every 2 seconds. I have this consumer

 @Bean
    fun testConsumer() = Consumer<String> {
            message ->
        logger.info { message }
    }

I tried below configs

spring.cloud.stream.bindings.testConsumer-in-0.consumer.poller.fixed-delay=2000
spring.cloud.stream.bindings.testConsumer-in-0.producer.poller.fixed-delay=2000

But it does not work. The consumer get the message as soon as it is published to the queue. Any idea?

0

There are 0 best solutions below