Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Messenger][Scheduler] Add AsCronTask & AsPeriodicTask attributes#51525
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
fd2967e
tod6a2819
CompareWhat could also be a cool feature here is add |
This looks nice! I'll give a proper review and help finish up for 6.4 when I have some time. What are you thinking for commands? I was thinking: #[AsCronTask(expression:'* * * * *', arguments:'arg --option')]class MyCommandextends Command{} |
valtzu commentedSep 2, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I was hoping we don't need such, as business logic usually is wrapped in a separate class and commands just act as an entry point, just like controllers. But I think this is only my reality. About the attribute syntax for commands, |
Looking good! Glad you got commands working - using |
6341a0a
tocd499ee
Comparevaltzu commentedSep 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hmm, ok it does not seem possible after all, if transportNames are not defined, then the message is not dispatched to any transport – unlike the Messenger docs are stating. |
cd499ee
toed27b20
CompareThank you@valtzu. |
@@ -10,6 +10,9 @@ services: | |||
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummySchedule: | |||
autoconfigure: true | |||
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyTask: | |||
autoconfigure: true |
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.
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.
@fabpot I'm not too familiar with the framework tests yet, and I'm also a bit busy now. I would need a week or two, if that's ok then I can try.
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.
Sure, there is no rush. Ping me if you need help.
… schedule (valtzu)This PR was merged into the 6.4 branch.Discussion----------[FrameworkBundle][Scheduler] Add test for autoconfigured schedule| Q | A| ------------- | ---| Branch? | 6.4| Bug fix? | no| New feature? | no| Deprecations? | no| License | MITAdd functional tests for autoconfigured schedules / tasks, as discussed in#51525 (comment).Commits-------ea2a8cd Add test for autoconfigured schedule
… schedule (valtzu)This PR was merged into the 6.4 branch.Discussion----------[FrameworkBundle][Scheduler] Add test for autoconfigured schedule| Q | A| ------------- | ---| Branch? | 6.4| Bug fix? | no| New feature? | no| Deprecations? | no| License | MITAdd functional tests for autoconfigured schedules / tasks, as discussed insymfony/symfony#51525 (comment).Commits-------ea2a8cd7255 Add test for autoconfigured schedule
faizanakram99 commentedJan 4, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
… Symfony command (W0rma)This PR was merged into the 6.4 branch.Discussion----------[Scheduler] Add example about how to pass arguments to a Symfony commandWe recently wanted to pass arguments to a Symfony command which is configured for the scheduler component with the `#[AsPeriodicTask]` attribute.The syntax mentioned insymfony/symfony#51525 (comment) worked.This PR adds an example to the docs.Commits-------fc90d83 [Scheduler] Add example about how to pass arguments to a Symfony command
Uh oh!
There was an error while loading.Please reload this page.
Simplify scheduler usage by allowing to declare an attribute
AsCronTask
/AsPeriodicTask
on any registered & autoconfigured service.Example usage:
bin/console debug:schedule
output:And then run
bin/console messenger:consume scheduler_default
to run the scheduler, like the usual.To-do (help needed):
RecurringMessage
s using DI)