-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Amqp] Add amqps support #38007
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
[Amqp] Add amqps support #38007
Conversation
Can you make it work currently using only |
I do not really understand, wdym? Connect to amqp with ssl ? |
In php-amqp/php-amqp#205, it looks like setting the |
It is : |
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cosmetic review.
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
I actually have added a new exception, I'm not sure it is useful and require to have a new PR merged first. The SSLException class, what do you think about it? Should I use a RuntimeException, a LogicException, or the new one? |
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments - looks good to me, though I have zero experience with this!
I've seen some confusion around people using amqps://
and it not working, which is partially why I suggest changing the message to also notify people that amqp://
IS a valid option. For CloudAMQP, I think they are now showing amqps://
by default, which is confusing some people when it doesn't work (especially beginners).
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/AmqpTransportFactory.php
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php
Outdated
Show resolved
Hide resolved
@vasilvestre Can you check the tests please? They seem to be broken by the changes introduced by this PR. |
Yes I'm actualling trying to search how we should handle ini parameters in tests, these are my own test, I think in phpunit.xml but the parameters should depend of system running tests, it could break on windows.. |
@fabpot it will pass this time :) |
Thank you @vasilvestre. |
@fabpot should I create a documentation PR? |
That would be awesome :). A docs issue has already been created |
here we are : symfony/symfony-docs#14250 |
To make this easier, should we automatically provide the cacert option to AMPQ if not configured, based on the CA file used by everything else in PHP (basically emulating what is suggested in php-amqp/php-amqp#311 as a better API) ? The |
If this seem fine to you, I would love working with queuing systems in future so I would love to work on this. :) |
Cases
Case 1 (simple):
I want to set up my app with a locally installed amqp broker supporting SSL. No auth is needed, no vhost, only SSL certificate file located at /etc/ssl/cafile.
'amqps://'
Case 2 (complex):
I use a special port, special file locations for SSL. I pass it through php.ini or configuration.
Questions
supports
function to see if 'amqp://' is contained in dsn string and accept cacert argument to use SSLHow are we supposed to cover AMQPS's case in your opinion?
cacert argument is settable through php.ini and code.
Observations
I think this PR should aim at:
EDIT
As discuted with @nicolas-grekas, we should check that cacert is existing in php.ini or is passed in configuration and throw an exception to give a nice feedback about what's wrong. Php amqp lib isn't actually precise about why it fails when you forget it.
Steps