>>Uncaught Bunny\Exception\ClientException: Broken pipe or closed connection.<< and how to solve it
We were running into this issue when our consumers or producers had nothing to do in a minute or less.
After searching the web, we found this issue ticket within the conversation.
Long story short, we could solve our problem by overwriting the default heartbeat with 30 seconds.
//this is an example but full blown configuration we are using
$client = new Client(
[
'heartbeat' => 30,
'host' => '127.0.0.1',
'password' => 'guest',
'user' => 'guest',
'vhost' => '/'
]
);
If you want to know more, you can read about rabbitmq networking here and about rabbitmq detecting dead tcp connections with heartbeat and tcp keepalives here