-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw connection exceptions on batch publish #983
Throw connection exceptions on batch publish #983
Conversation
Hi, Cheers :) |
Hi @foment , thanks for pointing this out and your efforts. Can You explain why You picked method |
Hi @ramunasd, thank you for the quick reply. The idea behind throwing an exception in One of the reasons behind all of this is to be able to catch proper exception in one of the legacy projects I'm currently working on and in general to have proper connection check before actually using it (like in |
So I don't see reason why "packet" method should be aware about connection. Please follow my suggestion. Thanks |
5b04e51
to
c1d9adb
Compare
PR updated with implemented suggestion. |
Codecov Report
@@ Coverage Diff @@
## master #983 +/- ##
============================================
+ Coverage 73.53% 74.39% +0.85%
Complexity 982 982
============================================
Files 35 35
Lines 2675 2675
============================================
+ Hits 1967 1990 +23
+ Misses 708 685 -23
Continue to review full report at Codecov.
|
We still use older version of phpunit :) |
Fix is on the way :) |
* Move connection check to the top of publish_batch method * Add unit tests for publish_batch method and opened/closed connection * Add support for older PHPUnit versions Co-authored-by: Aleksandar Jaksic <aleksandar.jaksic@check24.de>
Hello,
in bulk publishing, the connection existence is not checked (PhpAmqpLib/Channel/AMQPChannel.php:1232 in publish_batch method) and therefore we can't catch proper exception, like for example AMQPChannelClosedException.
This sometimes happens when there is a delay between opening the connection and actual publishing and for example in the meantime connection was closed for any reason whatsoever.
Therefore, here is the suggestion to throw a proper exception already in the prepare_method_frame method, like it's done for send_method_frame method in the AbstractChannel class.