Skip to content

Add signals#1

Merged
rmcdaniel merged 8 commits intomasterfrom
feature/signals
Oct 22, 2022
Merged

Add signals#1
rmcdaniel merged 8 commits intomasterfrom
feature/signals

Conversation

@rmcdaniel
Copy link
Member

@rmcdaniel rmcdaniel commented Oct 21, 2022

This PR adds the ability to await on a condition and signal a workflow.

For example:

class TestWorkflow extends Workflow
{
    private bool $canceled = false;

    #[SignalMethod]
    public function cancel()
    {
        $this->canceled = true;
    }

    public function execute()
    {
        yield WorkflowStub::await(fn () => $this->canceled);

        return;
    }
}

This workflow will reach the await() call and then pause until some external code signals the workflow like this:

$workflow->cancel();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant