Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Messenger] ReceiverInterface::handle() to get() & Worker with prioritized transports#30708
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
e7c770a tod5fd552Compare2ee34de to357cdb9Compare| } | ||
| $handled(null); | ||
| usleep(1000000); |
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.
Two changes here:
- I changed from .2 seconds to 1 second. Waiting only 200ms between when there is not a message is quite rapid. For reference, in Laravel, this defaults to 3 and is configurable on the command/worker.
357cdb9 to2d1f17bCompareweaverryan commentedMar 27, 2019 • edited by ogizanagi
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by ogizanagi
Uh oh!
There was an error while loading.Please reload this page.
This is ready! tl;dr In recent changes, the |
Uh oh!
There was an error while loading.Please reload this page.
2d1f17b tofa4776fComparesroze commentedMar 27, 2019
The reasoning of having |
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Worker/StopWhenTimeLimitIsReachedWorker.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Worker/StopWhenMessageCountIsExceededWorker.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
3864a11 to8866804Compare| * Stop receiving some messages. | ||
| */ | ||
| publicfunctionstop():void; | ||
| publicfunctionget():iterable; |
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 iterable, like always, was kind of a pain, compared to just returning one. But, itis more flexible and end-users won't touch this method much anyways.
Uh oh!
There was an error while loading.Please reload this page.
8866804 to9c9c4e0Compareweaverryan commentedMar 28, 2019
This is ready for review! Description updated. Better viewed (especially the |
Nyholm left a 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.
I really like this.
I am not a fan of priority in a message system, but this is priority of transports. That is a different thing. Im all 👍
(after my comments are addressed/answered)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
f5ebe36 to8356476Compare
Nyholm left a 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.
Good. I’m happy with the updated doc block on ReceiverInterface::get().
Thank you
fabpot left a 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.
minor typos
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedMar 30, 2019
Thank you@weaverryan. |
…ker with prioritized transports (weaverryan)This PR was squashed before being merged into the 4.3-dev branch (closes#30708).Discussion----------[Messenger] ReceiverInterface::handle() to get() & Worker with prioritized transports| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | Helps with#30699| License | MIT| Doc PR | TODOHighlights:* `messenger:consume` can now consume messages from multiple transports with priority ❗️```bin/console messenger:consume amqp_high amqp_medium amqp_low```* How long you want to sleep before checking more messages is now an option to `messenger:consume`* `ReceiverInterface::receive()` is replaced with `ReceiverInterface::get()`* Logic for looping & sleeping is moved into `Worker`Commits-------e800bd5 [Messenger] ReceiverInterface::handle() to get() & Worker with prioritized transports
fabpot commentedMar 30, 2019
typos fixed inf4176b0 |
| interface ReceiverInterface | ||
| { | ||
| /** | ||
| * Receive some messages to the given handler. |
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.
This doc is outdated: There is no "given handler"
…erInterface::get` phpdoc. (sroze)This PR was merged into the 4.3-dev branch.Discussion----------[Messenger] Remove the mention of handler in the `ReceiverInterface::get` phpdoc.| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#30708 (review)| License | MIT| Doc PR | øAs spotted by@Tobion, we don't have an handler as an argument anymore.Commits-------9c63112 Remove the mention of handler in the phpdoc.
…ryan)This PR was squashed before being merged into the 4.3-dev branch (closes#30754).Discussion----------[Messenger] New messenger:stop-workers Command| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | Kinda of#29451| License | MIT| Doc PR |symfony/symfony-docs#11236o/ me again.This requires and is built on top of#30708When you deploy, all workers need to be stopped and restarted. That's not currently possible, unless you manually track the pids and send a SIGTERM signal. We can make that much easier :).Now run:```bin/console messenger:stop-workers```And it will signal to all workers (even if they're distributed on other servers) that they should stop, once they finish processing their current message. This is done via a key in `cache.app`.Cheers!Commits-------5897162 [Messenger] New messenger:stop-workers Command
Tobion commentedMay 6, 2019
Just thinking out loud for reference: The prioritized transports can be used to prioritize messages by publishing messages to different transports and consuming them in order. But it's a different way than rabbitmq uses message priority. If you want to use rabbitmq priorities instead, you can do that by setting the priority attribute on the |
Uh oh!
There was an error while loading.Please reload this page.
Highlights:
messenger:consumecan now consume messages from multiple transports with priority ❗️messenger:consumeReceiverInterface::receive()is replaced withReceiverInterface::get()Worker