Reputation: 6003
If using spring with rabbitmq, how to set prefetch size to 1? The use case is to send task definition in xml to rabbitmq, and the many working servers could connect to it and do the task one by one. Since I'd like to have the max performance and let each server is busy, so I should set prefetch to 1 otherwise, some server could be much busier than the other.
Upvotes: 1
Views: 772
Reputation: 121282
Actually the SimpleMessageListenerContainer
has the setPrefetchCount
option, which is available from rabbit
Namespace:
<rabbit:listener-container prefetch="1">
<rabbit:listener queues="foo, bar" ref="myListener"/>
</rabbit:listener-container>
Upvotes: 2