Skip to content
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

Added php-amqplib support #24

Merged
merged 3 commits into from
Sep 2, 2014
Merged

Added php-amqplib support #24

merged 3 commits into from
Sep 2, 2014

Conversation

ThisIsAreku
Copy link
Contributor

I've added support of https://github.com/videlalvaro/php-amqplib, and also config for ssl. Note that at the moment, pecl-amqp didn't support ssl

@@ -14,7 +14,8 @@
"swarrot/swarrot": "~1.2",
"psr/log": "~1.0",
"symfony/framework-bundle": "~2.4",
"symfony/console": "~2.4"
"symfony/console": "~2.4",
"videlalvaro/php-amqplib": "2.4.*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't make it a hard dependency. People using the PECL extension don't need it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Taluu
Copy link

Taluu commented Sep 1, 2014

If it was up to me, I'd try to introduce a tag based detection as I proposed back in #2 , only simpler (just handling the provider in fact, rather than everything else)

@odolbeau
Copy link
Member

odolbeau commented Sep 1, 2014

Why not for something like #2. :)

Otherwise, @ThisIsAreku if you don't want do it yourself, something like this is enough to start :

$id = 'swarrot.factory.'.$config['provider'];
if (!$container->has($id)) {
  // throw exception
}

} else {
throw new \InvalidArgumentException('Only pecl is supported for now');
$id = 'swarrot.factory.'.$config['provider'];
if (!$container->has($id)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that this will still not allow other bundles to provide providers though. So it does not solve the case requested by #2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm quite new to symfony stuff, i don't know how to do this :/

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh, I think this is gonna be fine for now, as it means that at least all the providers supported by swarrot bundle (and also those registered as swarrot.factory.<something>, even in other bundles) can be easily registered.

the thing with the tag is just a little more advanced and does not limit the other bundles to use specifically this syntax. Hence, I think you can leave it like that, as it should be fine for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also those registered as swarrot.factory., even in other bundles

Precisely what is not working. The DI extension receives a temporary container, not the main one. So the only available services are the services defined by the DI extension itself (by loading the XML file 2 lines above)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just to merge this PR quickly, I'm agree that the solution #2 is better. :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I thought it was the real container, which doesn't seem to be the case. My bad then.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just to merge this PR quickly, I'm agree that the solution #2 is better. :)

Meh, I'll try to refactor it (simplifying, updating, ...) when I'll have a little bit of time then (except if somebody else wants to do it). :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, #2 moving all the DIC configuration to a compiler pass was not clean. There are probably better ways to provide such hook for external bundles

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I agree, it was just way too overkill ; But I think that at least handling the provider in a compiler pass should do just fine (especially since the introduction of the factories)

@odolbeau
Copy link
Member

odolbeau commented Sep 1, 2014

Can I merge this PR ?
Or should we provide better hooks before ?

@stof
Copy link
Contributor

stof commented Sep 1, 2014

@odolbeau IMO, you can merge it like that. Providing better hooks is a separate feature

@Taluu
Copy link

Taluu commented Sep 1, 2014

@odolbeau IMO, you can merge it like that. Providing better hooks is a separate feature

👍

odolbeau pushed a commit that referenced this pull request Sep 2, 2014
Added php-amqplib support
@odolbeau odolbeau merged commit 155c9d8 into swarrot:master Sep 2, 2014
@ThisIsAreku ThisIsAreku deleted the amqplib branch September 2, 2014 07:32
stof added a commit to stof/SwarrotBundle that referenced this pull request Sep 2, 2014
This fixes a mistakes introduced in swarrot#24.
Closes swarrot#25
@stof stof mentioned this pull request Sep 2, 2014
@ThisIsAreku ThisIsAreku restored the amqplib branch September 29, 2014 09:44
@ThisIsAreku ThisIsAreku deleted the amqplib branch October 2, 2014 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants