bunny
bunny copied to clipboard
Automatic reconnect
- [ ]
Client
option to allow reconnect (+ reconnect timeout) - [ ] open all previously opened channels
- [ ] start all previously started consumers
- what about anonymous queues?
- [ ] return callbacks
- [ ] confirm callbacks
- [ ] MAYBE: declare all previously declared queues
- only anonymous queues?
- [ ] MAYBE: declare all previously declared exchanges
The main problem with automatic reconnect is that exceptions are thrown directly (no link with the promise). The usual errors (during inactivity or network latencies) are then thrown by the event loop [https://github.com/jakubkulhan/bunny/blob/master/src/Bunny/AbstractClient.php#L282]. The only way to catch error is to try catch the eventloop (not optimal)
How can I help to extract the broken pipe and link it with the produce or consume promise ?
Yes, rejecting pending promises should also be performed, however, it won't suffice alone.
Here is a POC (with some reactiveX flavour) https://github.com/Domraider/bunny/blob/master/README.md
Updated to handle channel re-opening.
Solution was to wait for client to be connected : https://github.com/Domraider/bunny/blob/master/src/Bunny/Channel.php#L123
and reopen channel when connect is done : https://github.com/Domraider/bunny/blob/master/src/Bunny/Async/Client.php#L288
+1 on using Rx to solve this problem