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 symfony/messenger
recipe
#395
Conversation
sroze
commented
Mar 27, 2018
•
edited
edited
Q | A |
---|---|
License | MIT |
- Depends on [Messenger] Add AMQP adapter symfony#26632.
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.
Pull request does not pass validation.
43207f5
to
388a5c4
Compare
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.
Pull request does not pass validation.
I guess the review is invalid because obviously, the tag does not exist 🤔 |
symfony/messenger/4.1/manifest.json
Outdated
"env": { | ||
"MESSENGER_ADAPTER_DSN": "amqp://guest:guest@localhost:5672/%2f/messages" | ||
}, | ||
"aliases": ["messenger", "amqp"] |
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.
I'd also add "messaging" alias, WDYT?
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.
What about command_bus
too? Even if that's a bit reductive considering the wider component scope, that might be a good way to discover it.
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.
I like it: when making presentations about flex & hexagonal architecture, it's always badass to say "We need a command bus, so let's do composer req command_bus
😄
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.
I'm not sure about "messaging" tbh. command-bus
might be better as a meta-package (or other package), which will use the Messenger and auto-enable specific middlewares for command buses (see here)
symfony/messenger/4.1/manifest.json
Outdated
"env": { | ||
"MESSENGER_ADAPTER_DSN": "amqp://guest:guest@localhost:5672/%2f/messages" | ||
}, | ||
"aliases": ["messenger", "amqp"] |
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.
What about command_bus
too? Even if that's a bit reductive considering the wider component scope, that might be a good way to discover it.
symfony/messenger/4.1/manifest.json
Outdated
"config/": "%CONFIG_DIR%/" | ||
}, | ||
"env": { | ||
"MESSENGER_ADAPTER_DSN": "amqp://guest:guest@localhost:5672/%2f/messages" |
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.
Should we really provide this env var value by default? If there is no need for an adapter at first, can't we set it in the recipe to have null
as default and add a message explaining how to tweak it in order to use the amqp adapter?
I.e:
# config/packages/messenger.yaml
parameters:
env(MESSENGER_ADAPTER_DSN): null
or commenting adapters.default: "%env(MESSENGER_ADAPTER_DSN)%"
or providing the MESSENGER_ADAPTER_DSN="amqp://guest:guest@localhost:5672/%2f/messages"
var commented by default, as in
"#TRUSTED_PROXIES": "127.0.0.1,127.0.0.2", |
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.
I quite like the idea of commented lines for the adapters and environment variable as well. I've updated the PR accordingly 👍
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.
Pull request does not pass validation.
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.
Pull request passes validation.
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.
Pull request passes validation.
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.
I’m happy with this recipe. I usually ask for a link to the documentation but we can add that later.
# amqp: "%env(MESSENGER_ADAPTER_DSN)%" | ||
|
||
routing: | ||
# Route your messages to the senders... |
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.
Why the mysterious dots at the end ...?
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.
No reason 😄
|
||
routing: | ||
# Route your messages to the senders... | ||
# 'App\Message\YourMessage': messenger.sender.amqp |
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.
We're discussing allowing the short adapter name here - e.g. amqp
(and also service id's, of course). If we do that (I want to), it might be simpler to do that before merging the recipe.
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.
Fair point. For the records, it's here: symfony/symfony#26909
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.
Pull request passes validation.
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.
Pull request passes validation.
# amqp: "%env(MESSENGER_ADAPTER_DSN)%" | ||
|
||
routing: | ||
# Route your messages to the senders. |
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.
I would even remove this last dot.
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.
Here we go, removed (and actually replaced "senders" with "adapters" as it makes more sense now we the shorter name I believe).
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.
Pull request passes validation.
messenger: | ||
adapters: | ||
# Uncomment the following line to enable an adapter named "amqp" | ||
# amqp: "%env(MESSENGER_ADAPTER_DSN)%" |
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.
Single quote around the parameter?
symfony/messenger/4.1/manifest.json
Outdated
}, | ||
"env": { | ||
"#MESSENGER_ADAPTER_DSN": "amqp://guest:guest@localhost:5672/%2f/messages" | ||
}, |
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.
Perhaps post-install-output would be a good fit for mentioning the symfony/serializer-pack
to start using built-in transport easily.
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.
Maybe a new symfony/messenger-pack
would help to install both also.
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.
Any wording suggestion? :)
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.
<bg=blue;fg=white> </>
<bg=blue;fg=white> What's next? </>
<bg=blue;fg=white> </>
* You're ready to use the Messenger component. You can define your own message buses
or start using the default one right now by injecting the <info>messenger.bus.default</> service
or typehinting <info>Symfony\Component\Messenger\MessageBusInterface</> in your code.
* If you need to send messages to your broker, you can benefit from the built-in
amqp transport by:
1. Installing the <info>symfony/serializer-pack</>
2. Uncommenting the <comment> MESSENGER_ADAPTER_DSN</> env var
and `framework.messanger.transports.amqp` config
3. Routing your messages to the amqp sender.
* <fg=blue>Read</> the documentation at <comment>https://symfony.com/doc/master/components/messenger.html</>
(something like that)
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.
That's an amazing idea! Added a very similar content 👍
@@ -0,0 +1,9 @@ | |||
framework: | |||
messenger: | |||
adapters: |
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.
Should be renamed to transports
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.
Pull request passes validation.
0cfacbe
to
dfda2d4
Compare
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.
Pull request passes validation.
or typehinting <info>Symfony\Component\Messenger\MessageBusInterface</info> in your code. | ||
|
||
* If you need to send messages to your broker, you can benefit from the built-in | ||
amqp transport by: |
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.
AMQP
* If you need to send messages to your broker, you can benefit from the built-in | ||
amqp transport by: | ||
|
||
1. Installing the <info>symfony/serializer-pack</> |
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.
missing ;
at the end (same for the next bullet)
|
||
1. Installing the <info>symfony/serializer-pack</> | ||
2. Uncommenting the <comment> MESSENGER_ADAPTER_DSN</> env var | ||
and `framework.messanger.transports.amqp` config |
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.
You need to remove the backticks. Replace them with <comment>
?
amqp transport by: | ||
|
||
1. Installing the <info>symfony/serializer-pack</> | ||
2. Uncommenting the <comment> MESSENGER_ADAPTER_DSN</> env var |
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.
extra whitespace after <comment>
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.
Pull request passes validation.
@fabpot updated and added the |
symfony/messenger/4.1/manifest.json
Outdated
"config/": "%CONFIG_DIR%/" | ||
}, | ||
"env": { | ||
"#MESSENGER_ADAPTER_DSN": "amqp://guest:guest@localhost:5672/%2f/messages" |
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.
The #
looks weird here. Keep in mind that this is going to be used for more than the .env
file.
I would do something like: "#1": "MESSENGER_ADAPTER_DSN amqp://guest:guest@localhost:5672/%2f/messages",
instead.
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.
Well, that's what we do in the framework-bundle
as well.
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.
I'm not sure what you mean by #1
as a key 🤔
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.
We use the same here:
"#TRUSTED_PROXIES": "127.0.0.1,127.0.0.2", |
should we change it? Not sure to understand what you mean by
Keep in mind that this is going to be used for more than the .env file.
?
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.
We are using the env
config to update phpunit.xml
as well. So, using #
to mean "comment" is wrong. #1
is a convention to tell the parser that this is a comment, which is then interpreted depending on where we are using the env var.
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.
#1
is a convention to tell the parser that this is a comment, which is then interpreted depending on where we are using the env var.
Alright, I'm going to change it that way; though... is it documented somewhere? 🤔
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.
Pull request passes validation.
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.
Excellent work. Thank you
@symfony-flex-server review please |
@symfony-flex-server review |
That bot isn't really listening. 😛 |
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.
Pull request passes validation.