简体   繁体   中英

How consumer QueueChannel with some rate?

Here is example how fill and process queue. But how process message with rate? Like process N messages per second?

UPDATE Here by "porcess": I meant "dequeue". Eg how to dequeue N messages per second?

You can wrote a loop as I mentioned earlier with some kind of rate control (eg, via Thread.sleep as the most rudimentary). You can also try to use @Scheduled annotation.

Here is the example of a method that will be invoked 100 times per second

@Scheduled(fixedRate = 10)
public void dequeue() {
        //queue.poll(..)
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM