RabbitMQ prefetchCount and txSize in spring-rabbit

 Due to following implementation in SimpleMessageListenerContainer of spring-rabbit(1.1.2-RELEASE at this point) library, you should always change txSize as well if you want to decrease prefetchCount for some reason, otherwise txSize will override prefetchCount value.

    protected BlockingQueueConsumer createBlockingQueueConsumer() {
        BlockingQueueConsumer consumer;
        String[] queues = getRequiredQueueNames();
        // There's no point prefetching less than the tx size, otherwise the consumer will stall because the broker
        // didn't get an ack for delivered messages
        int actualPrefetchCount = prefetchCount > txSize ? prefetchCount : txSize;
        consumer = new BlockingQueueConsumer(getConnectionFactory(), this.messagePropertiesConverter, cancellationLock,
                getAcknowledgeMode(), isChannelTransacted(), actualPrefetchCount, this.defaultRequeueRejected, queues);
        return consumer;

댓글 없음:

댓글 쓰기

UIUC MCS-DS 2018 가을학기 끝, 그리고 2019 봄학기 등록 과목

이 포스팅은 제 미디엄(https://medium.com/@wjung/) 에 작성된 것의 중복포스팅입니다. 2018년 가을학기의 과목이었던 CS410 Text Information System을 드디어 끝냈다. 기말고사는 거의 2주 쯤 전인 12...