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

Add Enqueue recipes. #16

Merged
merged 9 commits into from
May 24, 2017
Merged

Add Enqueue recipes. #16

merged 9 commits into from
May 24, 2017

Conversation

makasim
Copy link
Contributor

@makasim makasim commented May 8, 2017

Q A
License MIT

This pull request adds a Symfony Flex recipe for Enqueue bundle and two transports filesystem and amqp.

Enqueue provides solutions to deal with message queues.

@@ -0,0 +1,23 @@
enqueue:
Copy link
Contributor

Choose a reason for hiding this comment

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

(I posted a comment that I removed, don't mind it, I didn't see that there were more recipes than just one in this PR)

It seems that this recipe is made for enqueue/amqp-ext, but actually this config file is intended to be used together with the enqueue/enqueue-bundle package, so it seems a bit wrong to put this config file in here.

Maybe this shows something we could propose as a new feature for flex: if specific package is installed, install more configuration, else, just "suggest" it.

Actually, enqueue/enqueue-bundle package should suggest enqueue/amqp-ext if it's something that could be used with it.

Maybe this is something that could be improved both on Flex side ( => add config files depending on whether another package is installed or not) on your bundle side (suggest more extensions directly in the bundle so the user can know that other extensions exist for the EnqueueBundle bundle and that they are automatically (I didn't check so, I may be wrong by saying that) activated when using the bundle if the package is installed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Imagine Bundle could benefit from such selective config, as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this shows something we could propose as a new feature for flex: if specific package is installed, install more configuration, else, just "suggest" it.

This might be a solution, though I support the point not to adding conditions to recipes.

The packs could be a solution to my problem. You do not install the bundle and amqp-ext separately but a enqueue/amqp-pack package. It installs the bundle and the transport and puts required configuration where needed

@makasim makasim changed the title [WIP] Add Enqueue Bundle recipes. Add Enqueue recipes. May 11, 2017
stof
stof previously requested changes May 11, 2017
"ENQUEUE_FS_STORAGE": "%VAR%/queue"
},
"gitignore": [
"/var/queue"
Copy link
Member

Choose a reason for hiding this comment

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

the whole content of var is already ignored in git, so this seems useless

Copy link
Contributor Author

@makasim makasim May 11, 2017

Choose a reason for hiding this comment

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

Yeah, I know. It is done this way just for that case when framework bundle is not installed. The var folder ignore rule is added only when you install the framework bundle.

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 could remove it if the case is not something we should worry about.

Copy link
Member

Choose a reason for hiding this comment

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

Framework bundle is a requirement, it cannot be uninstalled or not installed, so this is safe to remove.

Copy link
Member

Choose a reason for hiding this comment

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

btw, your own enqueue-bundle depends on FrameworkBundle 😄

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 overcomplicated things. fixed.

"var/": "%VAR_DIR%"
},
"env": {
"ENQUEUE_FS_STORAGE": "%VAR%/queue"
Copy link
Member

Choose a reason for hiding this comment

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

are you sure about %VAR% here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

port: '%env(ENQUEUE_AMQP_PORT)%'
login: '%env(ENQUEUE_AMQP_LOGIN)%'
password: '%env(ENQUEUE_AMQP_PASSWORD)%'
vhost: '%env(ENQUEUE_AMQP_VHOST)%'
Copy link
Member

Choose a reason for hiding this comment

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

I've have had a look, but do you support a URL/DSN as well? That's what we are using for Doctrine and Swiftmailer, so that would be great if possible to do the same here as well.

Copy link
Member

Choose a reason for hiding this comment

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

agreed here. PaaS expose credentials as a URL, so this config is not usable drop-in on such PaaS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -0,0 +1 @@
[Enqueue] Run <comment>make consume</> command to consume messages
Copy link
Member

Choose a reason for hiding this comment

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

I would remove this as the post install script if for things you need to do to make things work. It should not replace proper documentation of the package.

{
"copy-from-recipe": {
"etc/": "%ETC_DIR%/",
"var/": "%VAR_DIR%"
Copy link
Member

Choose a reason for hiding this comment

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

Is the var/queue/.gitkeep really needed? The package should be able to create it when it does not exist, right?

# port: '%env(ENQUEUE_AMQP_PORT)%'
# login: '%env(ENQUEUE_AMQP_LOGIN)%'
# password: '%env(ENQUEUE_AMQP_PASSWORD)%'
# vhost: '%env(ENQUEUE_AMQP_VHOST)%'
Copy link
Member

Choose a reason for hiding this comment

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

The whole config seems to be the same as the default one, except for the option. What about adding the comment on the default config with the explanation you have above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The transport name (a key) is different: amqp and rabbitmq_amqp.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then the If you use RabbitMQ broker ... part could just say "rename amqp with rabbitmq_amqp and the bundle will enable specific features ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@fabpot
Copy link
Member

fabpot commented May 11, 2017

Did you close on purpose?

@makasim
Copy link
Contributor Author

makasim commented May 12, 2017

Did you close on purpose?

it was closed when I merged php-enqueue/enqueue-dev#78. I wrote there "fixes XXX".

@@ -0,0 +1,6 @@
enqueue:
transport:
default: 'null'
Copy link
Member

Choose a reason for hiding this comment

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

This 'null' value must be a string or could be a normal null value instead?

enqueue:
transport:
default: 'null'
'null': ~
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this line: 'null': ~

Copy link
Member

Choose a reason for hiding this comment

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

it defines the configuration for the NullTransport. But the key must be quoted in YAML, as unquoting it would parse it as null, not as the string 'null'

Copy link
Member

Choose a reason for hiding this comment

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

This is extremely confusing to me: a "default transport" which is a null string ... which then is a "null transport" with a null value. Can we think a better approach for this? A new config option for tests maybe? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@javiereguiluz In this context 'null' is the name of the transport. The transport does not send nor receive anything. It is there just to mock a messaging API and useful in tests for example.

I've not come up with a better name for the transport.

Copy link
Member

Choose a reason for hiding this comment

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

Noop ? Blackhole ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, but not now. That's a huge change and would take time. I'll do it later on.

Is it a blocker?

Copy link
Contributor

Choose a reason for hiding this comment

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

Having a "null" object is very common and is, of course, a well know design pattern; why are we trying to rename something that already describes exactly what the transport is?

"var/": "%VAR_DIR%"
},
"env": {
"ENQUEUE_FS_STORAGE": "%VAR_DIR%/queue"
Copy link
Member

Choose a reason for hiding this comment

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

Just asking. If the bundles is called "enqueue", should the var/ dir be called "enqueue/" too? The "queue" name is too generic ... what if someday Symfony releases a Queue component or bundle?

symfony-bot
symfony-bot previously approved these changes May 13, 2017
@makasim
Copy link
Contributor Author

makasim commented May 15, 2017

I address all the review comments but the PR still red. It says (@stof stof requested changes). What should I do to this?

@fabpot
Copy link
Member

fabpot commented May 15, 2017

@stof needs to dismiss his review and someone else (including stof) need to approve the PR.

@makasim
Copy link
Contributor Author

makasim commented May 17, 2017

@stof needs to dismiss his review and someone else (including stof) need to approve the PR.

@stof I kindly remind you.

@@ -0,0 +1,5 @@
{
"env": {
"ENQUEUE_DSN": "file:/%VAR_DIR%/enqueue"
Copy link
Member

Choose a reason for hiding this comment

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

Will the library take care to create the directory if it does not exist yet?

Copy link
Contributor Author

@makasim makasim May 17, 2017

Choose a reason for hiding this comment

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

@symfony-bot symfony-bot merged commit 1043324 into symfony:master May 24, 2017
@@ -0,0 +1,5 @@
{
"env": {
"ENQUEUE_DSN": "file:/%VAR_DIR%/enqueue"
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we use here file:// instead of file:/ ?

Copy link
Contributor

@Pierstoval Pierstoval May 24, 2017

Choose a reason for hiding this comment

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

Isn't it a problem?
On Unix system, using file:// will result in paths like file:///var/www/dev/enqueue which might not work, whereas on windows it will result in file://e:/www/dev/enqueue which should work.

Dunno how to fix this 😱

Copy link
Member

Choose a reason for hiding this comment

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

I don't know about Linux, but on macOS file:///var/www/dev/enqueue not only works, but it's the only way this can work: 3 / after file: is normal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok nevermind, I tested on my ubuntu distro and file:/// works, once again I should check before talking

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 opened the issue. It'will be fixed.

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.

8 participants