rabbitmq
rabbitmq copied to clipboard
BulkConsumer doesn't produce errors
I have suspicious about BulkConsumer which silently skips throwable errors. I quickly looked into the code and there is the try-catch block in the BulkConsumer.php which probably cause this.
I would prefer to remove this block and let control returning values by man.
https://github.com/contributte/rabbitmq/blob/96a55a92dd805087e8e9f68af58fc5f46c708899/src/Consumer/BulkConsumer.php#L104
Well, it will definitivly swallow the exception, but how you imagine this will work? If exception is thrown, and 2 messages did pass and third have exception and $ waiting, should we send 2 acks and then nacks with exceptions?
I reached similar problem, although first I tried to ask nicely and sent out IConsumer::MESSAGE_REJECT_AND_TERMINATE in the array or responses and when that didn't work, I tried resorting to throwing an exception.
In my case, database was temporarily too busy and EntityManager closed. I wanted to reopen EntityManager, but it doesn't have a "reopen" method, seems it needs to be created again, but Nette DI would just give me the same instance of it and using the static create method wouldn't update DI
Considering messages that already passed, the code should never resort to throwing an exception, it should handle them and pass one of the status codes. On the other hand, BulkConsumer should respect the _AND_TERMINATE part of the response, it should always terminate if at least one of the returned status codes requests it.