I am using node+typescript+amqplib to build a project with rabbitMQ cloud service, if the QUEUE have 5 messages to consume, I use the code : channel.consume(queue, (msg) => {... } to consume the messages, I will get all the 5 messages in one time. how can I limit the number of message of AMQP in one time of consume? I mean, if I can limit one time 2 messages, I can get 2 messages at the first time, then get 2 at the second time, then 1 at the 3rd time, could you help me~
Asked
Active
Viewed 479 times
1 Answers
0
https://www.rabbitmq.com/consumer-prefetch.html
https://amqp-node.github.io/amqplib/channel_api.html#channel_prefetch
NOTE: the RabbitMQ team monitors the rabbitmq-users
mailing list and only sometimes answers questions on StackOverflow.

Luke Bakken
- 8,993
- 2
- 20
- 33