-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Scheduler] Add MessageHandler result to the PostRunEvent
#58546
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
[Scheduler] Add MessageHandler result to the PostRunEvent
#58546
Conversation
How does it work if the handler result type is "never"? I think It's better to use a message to transfer result. Possible to use a setter to add a result to the message inside a handler. |
If the MessageHandler does never return the $result value will be null. If the messagehandler is not in your own control(for instance RunCommandMessageHandler) it is not possible to use a setter to set the result to the message from the handler. The HandledStamp already collects the result of the message handler. This change will only allow you to use this result in the scheduler component as well. |
1705445
to
4e56ad4
Compare
@kbond Could you take a look at this maybe? |
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 think this makes sense. @alli83, have any thoughts?
03dceb0
to
468c02d
Compare
Thanks for the reply. I have also changed the |
468c02d
to
959b270
Compare
Retrieving the result could indeed be interesting e.g depending on the outcome, we might decide whether to continue or stop. |
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 good with this feature. Can you add an entry to the changelog?
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.
7.2 is in feature freeze so this will likely not make it until 7.3.
268e589
to
05fe4a3
Compare
@kbond I have rebased the branch on 7.3 |
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.
Looks good!
@bartholdbos, would you like to try updating the test? I was thinking here, instead of setting the props to true, set them to the event object and then assert on them in the test. If not, no worries, I can add after merge.
@kbond Sure, I have updated the test to use the event object instead of the booleans. It can now assert on properties that are in the event, is this what you meant? |
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.
Yes, that looks great!
src/Symfony/Component/Scheduler/Tests/EventListener/DispatchSchedulerEventListenerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Scheduler/Tests/EventListener/DispatchSchedulerEventListenerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Scheduler/Tests/EventListener/DispatchSchedulerEventListenerTest.php
Outdated
Show resolved
Hide resolved
Thanks for the review @kbond! I think it's ready on my side, is another review required or is it ready for merging by you/somebody else? |
Just need to wait for another core team member approval. |
@fabpot Could you maybe take a look at this? |
PostRunEvent
@bartholdbos, since this has been approved, it'll likely get approved by another core member and merged closer to the 7.3 feature freeze. |
3e9c00b
to
306eeb6
Compare
Thank you @bartholdbos. |
This PR will add the result of a MessageHandler to the PostRunEvent of the Scheduler Component. This can be used for example for retrieving the output of a RunCommandMessage scheduled by the scheduler component.