Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Messenger][Process] addRunProcessMessage andRunProcessMessageHandler#49813

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

Merged
fabpot merged 1 commit intosymfony:6.4fromkbond:messenger-process
Jul 29, 2023

Conversation

kbond
Copy link
Member

@kbondkbond commentedMar 25, 2023
edited
Loading

QA
Branch?6.3
Bug fix?no
New feature?yes
Deprecations?no
Ticketsn/a
LicenseMIT
Doc PRtodo

When reviewing how I could replace my cron scheduler with symfony/scheduler, I realized I need a way to schedule processes.

Usage

useSymfony\Component\Process\Exception\RunProcessFailedException;useSymfony\Component\Process\Messenger\RunProcessMessage;try {$context =$bus->dispatch(newRunProcessMessage('something'));$context->exitCode;// int$context->output;// string$context->errorOutput;// stringcatch(RunProcessFailedException$e) {$e->context->exitCode;// int$e->context->output;// string$e->context->errorOutput;// string}

TODO:

  • wire up
  • tests

OskarStark reacted with thumbs up emoji
@carsonbotcarsonbot added Status: Needs Review Feature Process RFCRFC = Request For Comments (proposals about features that you want to be discussed) labelsMar 25, 2023
@carsonbotcarsonbot added this to the6.3 milestoneMar 25, 2023
@carsonbotcarsonbot changed the title[Process][RFC] addExecuteProcess andExecuteProcessHandler[Process] addExecuteProcess andExecuteProcessHandlerMar 25, 2023
@kbond
Copy link
MemberAuthor

Looking for feedback before proceeding further.

@kbondkbond changed the title[Process] addExecuteProcess andExecuteProcessHandler[Process][Messenger] addExecuteProcess andExecuteProcessHandlerMar 25, 2023
@carsonbotcarsonbot changed the title[Process][Messenger] addExecuteProcess andExecuteProcessHandler[Messenger][Process] addExecuteProcess andExecuteProcessHandlerMar 25, 2023
@kbondkbond changed the title[Messenger][Process] addExecuteProcess andExecuteProcessHandler[Messenger][Process] addProcessMessage andProcessMessageHandlerMar 27, 2023
@kbondkbondforce-pushed themessenger-process branch 3 times, most recently from17b805b to9a285c3CompareMarch 27, 2023 14:50
@kbondkbond removed the RFCRFC = Request For Comments (proposals about features that you want to be discussed) labelMar 27, 2023
@kbond
Copy link
MemberAuthor

kbond commentedMar 27, 2023
edited
Loading

Pending a resolution to#49813 (comment), I think this is ready.

@OskarStarkOskarStark requested a review fromfabpotMarch 29, 2023 11:33
) {
}

public function __toString(): string
Copy link
Contributor

@ro0NLro0NLApr 24, 2023
edited
Loading

Choose a reason for hiding this comment

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

generally what about just dumping payloads ($dump($messsage)) in CLI for -v[vv]?

OskarStark reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Can you explain this a bit more, I'm not understanding what you mean.

@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.4May 23, 2023
@kbondkbond changed the title[Messenger][Process] addProcessMessage andProcessMessageHandler[Messenger][Process] addRunProcessMessage andRunProcessMessageHandlerJul 28, 2023
@kbond
Copy link
MemberAuthor

I've renamed the classes per the review.

I've also added aRunProcessContext that's returned from the handler and aRunProcessFailedException that's thrown by the handler on failure. These will allow the message/exception to be serialized while still giving access to the result.

@kbond
Copy link
MemberAuthor

Comments addressed and PR description updated to show usage.

@fabpot
Copy link
Member

Thank you@kbond.

@fabpotfabpot merged commit70768ff intosymfony:6.4Jul 29, 2023
fabpot added a commit that referenced this pull requestJul 30, 2023
…ommandMessageHandler` (kbond)This PR was squashed before being merged into the 6.4 branch.Discussion----------[Console][Messenger] add `RunCommandMessage` and `RunCommandMessageHandler`| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | n/a| License       | MIT| Doc PR        | todoSimilar to#49813, when using the scheduler it could be useful to execute commands.## Usage```phpuse Symfony\Component\Console\Exception\RunCommandFailedException;use Symfony\Component\Console\Messenger\RunCommandMessage;try {    $context = $bus->dispatch(new RunCommandMessage('my:command'));    $context->output; // string - output of command    $context->exitCode; // int - the exit codecatch(RunCommandFailedException $e) { // if exit code is non-zero or command threw exception    $e->context->output; // string - output of command    $e->context->exitCode; // int - the exit code    $e->getPrevious(); // null|\Throwable exception command threw if applicable}// "never" fail$context = $bus->dispatch(new RunCommandMessage('my:command', throwOnNonSuccess: false, catchExceptions: true));```TODO:- [x] wire up- [x] testsCommits-------dd5b0b7 [Console][Messenger] add `RunCommandMessage` and `RunCommandMessageHandler`
This was referencedOct 21, 2023
@kbondkbond deleted the messenger-process branchFebruary 17, 2025 14:02
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stloydstloydstloyd left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@OskarStarkOskarStarkOskarStark left review comments

@ro0NLro0NLro0NL left review comments

@fabpotfabpotfabpot approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

7 participants
@kbond@fabpot@stloyd@nicolas-grekas@OskarStark@ro0NL@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp