-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Decouple from symfony/http-client #1318
Comments
It might be hard because async is provided by symfony/http-client-contracts, and symfony/http-client is the only implementation I'm aware of. We could add |
This would make sense if someone writes an (Note that a generic one for PSR-18 wouldn't make sense since it's not async.) |
Perhaps one of php-http/async-client-implementation could be used here? But yeah even if interface wasn't changed in this package (and indeed it won't be anytime soon as that would be a BC break), we can still add symfony/http-client-contracts to supported packages as you suggested and if somebody creates adapter for this interface in future it would be still beneficial |
Would work for me as a 1st step. Up for a PR? |
Actually, AsyncAws does not need As far as I know, there are no "real" implementation of this contract (https://packagist.org/providers/symfony/http-client-implementation), and I'm not such switching to PSR and keeping the same experience is possible. |
I'm 100% sure it is not possible to switch to PSR-18 and to keep the same experience (if you consider the concurrency part of the experience of course, but this is a given to me as this is what justifies the "async" in the project name). Whether a |
This is where the Fibers are useful: add async capacity with sync interfaces. With a fiber-based http client, like async-aws offers more than being built of top of the async Implementing If async-aws was able to switch to a psr-18 client AND a psr-18 adapter was implemented for |
actually symfony/messenger leverage the async behavior of async-aws https://github.com/symfony/symfony/blob/455bd4342e652047b0ffab1ba00d98a77812d8c8/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php#L233 People can use this lib in an async or sync way whatever the version of php: with or without event loop .. |
Thank you @jderusse for pointing. I should have say "reactive" instead of "async". Actually, thanks to Symfony http client, you made it possible to run parallel long-polling http requests and check the status of each in a loop. The Also, publishing a message is currently blocking operation: the Response object is immediately destructed. I took SQS and messenger as an example, but the same goes for other services. It's easier to write fibers to parallelize various tasks instead of writing the code that coordinate and optimize execution (the symfony http client way). |
Not arguing about the rest of your message, but this might build on false assumptions. At least here: symfony/http-client doesn't poll anything, it reacts to network events. But maybe I missed what you meant... |
FWIW, the https://github.com/FriendsOfPHP/well-known-implementations repo has been archived. So it seems we won't have this for a bit. I've created this adapter: https://github.com/SAM-IT/symfony-http-psr18 and use it in production. This is not async, but I don't see the need for it in most use cases:
|
This is a continuation of #756
What changed since then? https://twitter.com/nicolasgrekas/status/1583454980769730560
https://github.com/FriendsOfPHP/well-known-implementations has been created which matches this use case. We can have both worlds:
The text was updated successfully, but these errors were encountered: