In my case I am using the php-amqplib/rabbitmq-bundle on a Symfony project, I was getting the error 'Connection reset by peer' very often, the problem was related to the prefetch size, so by limiting the prefetch size I got rid of this error.
On the consumer configuration you need to add the line below:
qos_options: {prefetch_size: 0, prefetch_count: 1, global: false}
You will have something like this:
consumers:
consumer_name:
connection: default
exchange_options: {name: 'consumer-name', type: direct}
queue_options: {name: 'consumer-name'}
callback: consumer_name_service
qos_options: {prefetch_size: 0, prefetch_count: 1, global: false}